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

17
LINES

< > BotCompany Repo | #1013354 // serveHttpWithWebsockets_multiplePorts

JavaX fragment (include)

static L<WebSocketHTTPD> serveHttpWithWebsockets_multiplePorts_servers = synchroList();

// factory: func(NanoHTTPD.IHTTPSession) -> WebSocket
static void serveHttpWithWebsockets_multiplePorts(O factory, int... ports) ctex {
  for (int port : ports) {
    WebSocketHTTPD httpd = new WebSocketHTTPD(port, factory);
    serveHttpWithWebsockets_multiplePorts_servers.add(httpd);
    httpd.start();
  }
}

static void cleanMeUp_serveHttpWithWebsockets_multiplePorts() {
  for (WebSocketHTTPD httpd : cloneList(serveHttpWithWebsockets_multiplePorts_servers)) {
    pcall { httpd.stop(); }
    serveHttpWithWebsockets_multiplePorts_servers.remove(httpd);
  }
}

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: 458 / 468
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018507 - serveHttpsWithWebsockets_multiplePorts