src code

instance method Client#send

Client#send(message) → undefined
  • message (String) – The String that you will be sending to the server.

Sends message to the currently connected server if it is connected. If this Client instance is not connected when this is called, then an exception is thrown. As such, it's a good idea to place calls to Client#send inside of a try catch block:

try {
    client.send("hello server!");
} catch(ex) {
    SGF.log(ex);
}

A use case when an exception is thrown would be to add message to some sort of queue that gets sent during the Client#onOpen event.