Package jadex.extension.rs.publish
Class NanoWebsocketServer
- java.lang.Object
-
- fi.iki.elonen.NanoHTTPD
-
- fi.iki.elonen.NanoWSD
-
- jadex.extension.rs.publish.NanoHttpServer
-
- jadex.extension.rs.publish.NanoWebsocketServer
-
public class NanoWebsocketServer extends NanoHttpServer
The nano websocket server handles websocket requests from clients like browsers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class fi.iki.elonen.NanoWSD
fi.iki.elonen.NanoWSD.State, fi.iki.elonen.NanoWSD.WebSocket, fi.iki.elonen.NanoWSD.WebSocketException, fi.iki.elonen.NanoWSD.WebSocketFrame
-
Nested classes/interfaces inherited from class fi.iki.elonen.NanoHTTPD
fi.iki.elonen.NanoHTTPD.AsyncRunner, fi.iki.elonen.NanoHTTPD.ClientHandler, fi.iki.elonen.NanoHTTPD.ContentType, fi.iki.elonen.NanoHTTPD.Cookie, fi.iki.elonen.NanoHTTPD.CookieHandler, fi.iki.elonen.NanoHTTPD.DefaultAsyncRunner, fi.iki.elonen.NanoHTTPD.DefaultServerSocketFactory, fi.iki.elonen.NanoHTTPD.DefaultTempFile, fi.iki.elonen.NanoHTTPD.DefaultTempFileManager, fi.iki.elonen.NanoHTTPD.HTTPSession, fi.iki.elonen.NanoHTTPD.IHTTPSession, fi.iki.elonen.NanoHTTPD.Method, fi.iki.elonen.NanoHTTPD.Response, fi.iki.elonen.NanoHTTPD.ResponseException, fi.iki.elonen.NanoHTTPD.SecureServerSocketFactory, fi.iki.elonen.NanoHTTPD.ServerRunnable, fi.iki.elonen.NanoHTTPD.ServerSocketFactory, fi.iki.elonen.NanoHTTPD.TempFile, fi.iki.elonen.NanoHTTPD.TempFileManager, fi.iki.elonen.NanoHTTPD.TempFileManagerFactory
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractWebSocketServer
server
The websocket server functionality.protected java.util.Map<fi.iki.elonen.NanoHTTPD.IHTTPSession,jadex.extension.rs.publish.NanoWebsocketServer.MyWebSocket>
websockets
The websockets per session.-
Fields inherited from class jadex.extension.rs.publish.NanoHttpServer
handler
-
-
Constructor Summary
Constructors Constructor Description NanoWebsocketServer(int port, IExternalAccess agent, IRequestHandlerService handler)
Creates the server.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected jadex.extension.rs.publish.NanoWebsocketServer.MyWebSocket
getWebSocket(fi.iki.elonen.NanoHTTPD.IHTTPSession session)
Get websocket per session.protected fi.iki.elonen.NanoWSD.WebSocket
openWebSocket(fi.iki.elonen.NanoHTTPD.IHTTPSession session)
Opens a web socket.void
start()
-
Methods inherited from class jadex.extension.rs.publish.NanoHttpServer
serveHttp
-
Methods inherited from class fi.iki.elonen.NanoWSD
isWebsocketRequested, makeAcceptKey, serve, useGzipWhenAccepted
-
Methods inherited from class fi.iki.elonen.NanoHTTPD
closeAllConnections, createClientHandler, createServerRunnable, decodeParameters, decodeParameters, decodePercent, getHostname, getListeningPort, getMimeTypeForFile, getServerSocketFactory, getTempFileManagerFactory, isAlive, makeSecure, makeSSLSocketFactory, makeSSLSocketFactory, makeSSLSocketFactory, mimeTypes, newChunkedResponse, newFixedLengthResponse, newFixedLengthResponse, newFixedLengthResponse, serve, setAsyncRunner, setServerSocketFactory, setTempFileManagerFactory, start, start, stop, wasStarted
-
-
-
-
Field Detail
-
server
protected AbstractWebSocketServer server
The websocket server functionality.
-
websockets
protected java.util.Map<fi.iki.elonen.NanoHTTPD.IHTTPSession,jadex.extension.rs.publish.NanoWebsocketServer.MyWebSocket> websockets
The websockets per session.
-
-
Constructor Detail
-
NanoWebsocketServer
public NanoWebsocketServer(int port, IExternalAccess agent, IRequestHandlerService handler)
Creates the server.- Parameters:
port
- Port of the server.
-
-
Method Detail
-
start
public void start() throws java.io.IOException
- Overrides:
start
in classfi.iki.elonen.NanoHTTPD
- Throws:
java.io.IOException
-
openWebSocket
protected fi.iki.elonen.NanoWSD.WebSocket openWebSocket(fi.iki.elonen.NanoHTTPD.IHTTPSession session)
Opens a web socket.- Specified by:
openWebSocket
in classfi.iki.elonen.NanoWSD
-
getWebSocket
protected jadex.extension.rs.publish.NanoWebsocketServer.MyWebSocket getWebSocket(fi.iki.elonen.NanoHTTPD.IHTTPSession session)
Get websocket per session.- Parameters:
session
- The session.- Returns:
- The socket.
-
-