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

30
LINES

< > BotCompany Repo | #1014041 // serveHttpsWithWebsockets

JavaX fragment (include)

static WebSocketHTTPD serveHttpsWithWebsockets_server;
static int serveHttpsWithWebsockets_port = 8443;

static new TreeSet<String> serveHttpsWithWebsockets_peers;

// factory: func(NanoHTTPD.IHTTPSession) -> WebSocket
static int serveHttpsWithWebsockets(int port, File keystore, S pass, O factory) ctex {
  serveHttpsWithWebsockets_port = port;
  serveHttpsWithWebsockets_server = new WebSocketHTTPD(port, factory);
  serveHttpsWithWebsockets_server.makeSecure(serveHttps_makeSSLSocketFactory(keystore, pass));
serveHttpsWithWebsockets_server.start();
  ret serveHttpsWithWebsockets_port();
}

// serve on random port, return port number used
static int serveHttpsWithWebsockets(File keystore, S pass, O factory) {
  serveHttpsWithWebsockets(0, keystore, pass, factory);
  ret serveHttpsWithWebsockets_port();
}

static int serveHttpsWithWebsockets_port() {
  ret serveHttpsWithWebsockets_server == null ? 0 : serveHttpsWithWebsockets_server.getListeningPort();
}

static void cleanMeUp_serveHttpsWithWebsockets() {
  if (serveHttpsWithWebsockets_server != null) {
    serveHttpsWithWebsockets_server.stop();
    serveHttpsWithWebsockets_server = null;
  }
}

Author comment

Began life as a copy of #1009197

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: #1014041
Snippet name: serveHttpsWithWebsockets
Eternal ID of this version: #1014041/3
Text MD5: 03ce2909d40f6241a007d7d6f6b93bc9
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-25 15:30:05
Source code size: 1188 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 436 / 475
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)