WebSocket & WebSocket Secure transport implementation
Types
WsTransport = ref object of Transport httpservers: seq[HttpServer] wsserver: WSServer connections: array[Direction, seq[WsStream]] acceptFuts: seq[Future[HttpRequest]] tlsPrivateKey: TLSPrivateKey tlsCertificate: TLSCertificate tlsFlags: set[TLSFlags] flags: set[ServerFlags] handshakeTimeout: Duration factories: seq[ExtFactory] rng: ref HmacDrbgContext
- Source Edit
Procs
proc new(T: type WsStream; session: WSSession; dir: Direction; observedAddr: Opt[MultiAddress]; timeout = 10.minutes): T:type {. ...raises: [].}
- Source Edit
proc new(T: typedesc[WsTransport]; upgrade: Upgrade; flags: set[ServerFlags] = {}; factories: openArray[ExtFactory] = []; rng: ref HmacDrbgContext = nil; handshakeTimeout = DefaultHeadersTimeout): T:type {.public, ...raises: [].}
- Creates a clear-text WebSocket transport Source Edit
proc new(T: typedesc[WsTransport]; upgrade: Upgrade; tlsPrivateKey: TLSPrivateKey; tlsCertificate: TLSCertificate; tlsFlags: set[TLSFlags] = {}; flags: set[ServerFlags] = {}; factories: openArray[ExtFactory] = []; rng: ref HmacDrbgContext = nil; handshakeTimeout = DefaultHeadersTimeout): T:type {.public, ...raises: [].}
- Creates a secure WebSocket transport Source Edit
proc secure(self: WsTransport): bool {....raises: [], tags: [].}
- Source Edit
Methods
method accept(self: WsTransport): Future[Connection] {.stackTrace: false, ...gcsafe, raises: [], raises: [], raises: [], tags: [RootEffect].}
- accept a new WS connection Source Edit
method closeImpl(s: WsStream): Future[void] {.stackTrace: false, ...gcsafe, raises: [], raises: [], raises: [], tags: [RootEffect].}
- Source Edit
method getWrapped(s: WsStream): Connection {....raises: [], tags: [].}
- Source Edit
method handles(t: WsTransport; address: MultiAddress): bool {....gcsafe, raises: [], tags: [].}
- Source Edit
method initStream(s: WsStream) {....raises: [], tags: [RootEffect, TimeEffect].}
- Source Edit
method readOnce(s: WsStream; pbytes: pointer; nbytes: int): Future[int] {. stackTrace: false, ...gcsafe, raises: [], raises: [], raises: [], tags: [RootEffect].}
- Source Edit
method start(self: WsTransport; addrs: seq[MultiAddress]): Future[void] {. stackTrace: false, ...gcsafe, raises: [], raises: [], raises: [], tags: [RootEffect].}
- listen on the transport Source Edit
method stop(self: WsTransport): Future[void] {.stackTrace: false, ...gcsafe, raises: [], raises: [], raises: [], tags: [RootEffect].}
- stop the transport Source Edit