Skip to content

Instantly share code, notes, and snippets.

@kalaiyarasiganeshalingam
Last active January 3, 2021 15:37
Show Gist options
  • Select an option

  • Save kalaiyarasiganeshalingam/f2bade3f23c6e0d0beee243795ecdc4d to your computer and use it in GitHub Desktop.

Select an option

Save kalaiyarasiganeshalingam/f2bade3f23c6e0d0beee243795ecdc4d to your computer and use it in GitHub Desktop.
import ballerina/io;
import ballerina/http;
public function main() {
http:WebSocketClient wsClientEp = new("ws://localhost:9090/websocket", config = {callbackService: ClientService});
checkpanic wsClientEp->pushText("hello");
}
service ClientService =@http:WebSocketServiceConfig {} service {
resource function onText(http:WebSocketClient conn, string text, boolean finalFrame) {
io:println(text);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment