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, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- accept a new WS connection Source Edit
method closeImpl(s: WsStream): InternalRaisesFuture[void, void] {. stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit
method dial(self: WsTransport; hostname: string; address: MultiAddress; peerId: Opt[PeerId] = Opt.none(PeerId)): Future[Connection] {. stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- dial a peer 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: [TimeEffect, RootEffect].}
- Source Edit
method readOnce(s: WsStream; pbytes: pointer; nbytes: int): InternalRaisesFuture[ int, (CancelledError, LPStreamError)] {.stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit
method start(self: WsTransport; addrs: seq[MultiAddress]): Future[void] {. stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- listen on the transport Source Edit
method stop(self: WsTransport): Future[void] {.stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- stop the transport Source Edit
method write(s: WsStream; msg: seq[byte]): InternalRaisesFuture[void, (CancelledError, LPStreamError)] {.stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit