vapor-docs/3.0/docs/websocket/client.md

589 B

WebSocket Client

WebSocket clients work the same on the client side as the server side.

Connecting a WebSocket client

WebSockets require an URI to connect to and a Worker to run on.

let worker: Worker = ...

let futureWebSocket: Future<WebSocket> = try WebSocket.connect(to: "ws://localhost/path", queue: queue)

Using websockets

WebSockets are interacted with using binary streams or text streams.

All other information about websockets is defined here.