Dart API Referencedart:ioWebSocketConnection

WebSocketConnection Interface

Server web socket connection.

Extends

Hashable

Methods

Code close([int status, String reason]) #

Close the web socket connection. The default value for status and reason are null.

close([int status, String reason]);

Code int hashCode() #

WebSocketConnection is hashable.

int hashCode();

Code void set onClosed(void callback(int status, String reason)) #

Sets the callback to be called when the web socket connection is closed.

void set onClosed(void callback(int status, String reason));

Code void set onError(void callback(e)) #

Sets the callback to be called when the web socket connection encountered an error.

void set onError(void callback(e));

Code void set onMessage(void callback(message)) #

Sets the callback to be called when a message have been received. The type on message is either String or List<int> depending on whether it is a text or binary message. If the message is empty message will be null.

void set onMessage(void callback(message));

Code send(Object message) #

Sends a message. The message must be a String a List<int> or null.

send(Object message);