Libraryless. Click here for Pure Java version (5374L/40K).
import javax.net.*; import javax.net.ssl.*; static L<WebSocketHTTPD> serveHttpsWithWebsockets_multiplePorts_servers = synchroList(); // factory: func(NanoHTTPD.IHTTPSession) -> WebSocket static void serveHttpsWithWebsockets_multiplePorts(File keystore, S pass, O factory, int... ports) ctex { for (int port : ports) { WebSocketHTTPD httpd = new WebSocketHTTPD(port, factory); httpd.makeSecure(makeSSLServerSocketFactory(keystore, pass)); serveHttpsWithWebsockets_multiplePorts_servers.add(httpd); httpd.start(); } } // factory: func(NanoHTTPD.IHTTPSession) -> WebSocket static void serveHttpsWithWebsockets_multiplePorts(SSLServerSocketFactory socketFactory, O factory, int... ports) ctex { for (int port : ports) { WebSocketHTTPD httpd = new WebSocketHTTPD(port, factory); httpd.makeSecure(socketFactory); serveHttpsWithWebsockets_multiplePorts_servers.add(httpd); httpd.start(); } } static void cleanMeUp_serveHttpsWithWebsockets_multiplePorts() { for (WebSocketHTTPD httpd : cloneList(serveHttpsWithWebsockets_multiplePorts_servers)) { pcall { httpd.stop(); } serveHttpsWithWebsockets_multiplePorts_servers.remove(httpd); } }
Began life as a copy of #1013354
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018507 |
Snippet name: | serveHttpsWithWebsockets_multiplePorts |
Eternal ID of this version: | #1018507/6 |
Text MD5: | 22bbed0eb3da18d3b1090b257da73a17 |
Transpilation MD5: | e95747ab483578e37e27224aed6d0604 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-02 15:26:56 |
Source code size: | 1214 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 314 / 419 |
Version history: | 5 change(s) |
Referenced in: | [show references] |