Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1013354 // serveHttpWithWebsockets_multiplePorts

JavaX fragment (include)

1  
static L<WebSocketHTTPD> serveHttpWithWebsockets_multiplePorts_servers = synchroList();
2  
3  
// factory: func(NanoHTTPD.IHTTPSession) -> WebSocket
4  
static void serveHttpWithWebsockets_multiplePorts(O factory, int... ports) ctex {
5  
  for (int port : ports) {
6  
    WebSocketHTTPD httpd = new WebSocketHTTPD(port, factory);
7  
    serveHttpWithWebsockets_multiplePorts_servers.add(httpd);
8  
    httpd.start();
9  
  }
10  
}
11  
12  
static void cleanMeUp_serveHttpWithWebsockets_multiplePorts() {
13  
  for (WebSocketHTTPD httpd : cloneList(serveHttpWithWebsockets_multiplePorts_servers)) {
14  
    pcall { httpd.stop(); }
15  
    serveHttpWithWebsockets_multiplePorts_servers.remove(httpd);
16  
  }
17  
}

Author comment

Began life as a copy of #1011858

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013354
Snippet name: serveHttpWithWebsockets_multiplePorts
Eternal ID of this version: #1013354/4
Text MD5: 58035e373fe38dd8c308030e498f6113
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-03 02:42:51
Source code size: 670 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 457 / 468
Version history: 3 change(s)
Referenced in: [show references]