Class WebSocketImpl
java.lang.Object
com.codename1.impl.WebSocketImpl
Platform contract behind the public com.codename1.io.WebSocket facade.
Each port that supports WebSocket subclasses this and is returned from
CodenameOneImplementation.createWebSocketImpl(String).
Subclasses call sink().onConnect(), sink().onTextMessage(...), etc.
from whichever thread the native layer fires the event on. The sink is
set exactly once, by the facade, before connect(int) is called.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Close the connection.abstract voidconnect(int connectTimeoutMs) Initiate the connection.abstract WebSocketStatefinal StringgetUrl()abstract voidsendBinary(byte[] message) abstract voidfinal voidprotected final WebSocketEventSinksink()
-
Constructor Details
-
WebSocketImpl
-
-
Method Details
-
getUrl
-
setEventSink
-
sink
-
connect
public abstract void connect(int connectTimeoutMs) Initiate the connection. May return immediately and complete asynchronously; success is signalled viasink().onConnect().- Parameters:
connectTimeoutMs- handshake timeout in milliseconds, or 0 for the platform default.
-
close
public abstract void close()Close the connection. Idempotent -- calling on an already-closed connection is a no-op. -
sendText
-
sendBinary
public abstract void sendBinary(byte[] message) -
getReadyState
-