Class
WebSocket
final class WebSocket
Topics
Structures
WebSocket.ConfigurationStores configuration for a WebSocket client/server instance
Instance Properties
closeCodeeventLoopisClosedonClosepingIntervalIf set, this will trigger automatic pings on the connection. If ping is not answered before the next ping is sent, then the WebSocket will be presumed inactive and will be closed automatically. These pings can also be used to keep the WebSocket alive if there is some other timeout mechanism shutting down inactive connections, such as a Load Balancer deployed in front of the server.
Instance Methods
close(code:)close(code:promise:)onBinary(_:)onPing(_:)onPong(_:)onText(_:)send(_:)send(_:opcode:fin:promise:)Send the provided data in a WebSocket frame.send(_:promise:)send(raw:opcode:fin:)send(raw:opcode:fin:promise:)sendPing()sendPing(_:)sendPing(_:promise:)sendPing(promise:)
Type Methods
client(on:config:onUpgrade:)Sets up a channel to operate as a WebSocket client.client(on:onUpgrade:)Sets up a channel to operate as a WebSocket client.connect(scheme:host:port:path:query:headers:configuration:on:onUpgrade:)Establish a WebSocket connection.connect(scheme:host:port:path:query:headers:proxy:proxyPort:proxyHeaders:proxyConnectDeadline:configuration:on:onUpgrade:)Establish a WebSocket connection via a proxy server.connect(to:headers:configuration:on:onUpgrade:)Establish a WebSocket connection.connect(to:headers:proxy:proxyPort:proxyHeaders:proxyConnectDeadline:configuration:on:onUpgrade:)Descriptionserver(on:config:onUpgrade:)Sets up a channel to operate as a WebSocket server.server(on:onUpgrade:)Sets up a channel to operate as a WebSocket server.
Relationships
Conforms To
Swift.SendableSwift.SendableMetatype