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: Rng
- Source Edit
Consts
WsTransportTrackerName = "libp2p.wstransport"
- Source Edit
Procs
proc new(T: type WsStream; session: WSSession; dir: Direction; timeout = 10.minutes; observedAddr: MultiAddress = MultiAddress()): T:type {. ...raises: [].}
- Source Edit
proc new(T: typedesc[WsTransport]; upgrade: Upgrade; flags: set[ServerFlags] = {}; factories: openArray[ExtFactory] = []; rng: Rng = 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: Rng = 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] {....gcsafe, stackTrace: false, ...gcsafe, raises: [], raises: [], tags: [RootEffect].}
- accept a new WS connection Source Edit
method closeImpl(s: WsStream): Future[void] {.stackTrace: false, ...gcsafe, 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 readOnce(s: WsStream; pbytes: pointer; nbytes: int): Future[int] {. stackTrace: false, ...gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit
method start(self: WsTransport; addrs: seq[MultiAddress]): Future[void] {. stackTrace: false, ...gcsafe, raises: [], raises: [], tags: [RootEffect].}
- listen on the transport Source Edit
method stop(self: WsTransport): Future[void] {....gcsafe, stackTrace: false, ...gcsafe, raises: [], raises: [], tags: [RootEffect].}
- stop the transport Source Edit