How to use @swim/warp - 2 common examples

To help you get started, we’ve selected a few @swim/warp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swimos / swim / swim-system-js / swim-mesh-js / @swim / client / main / host / WebSocketHost.ts View on Github external
protected onWebSocketOpen(): void {
    if (this.isConnected()) {
      const credentials = this.credentials();
      if (credentials.isDefined()) {
        const request = new AuthRequest(credentials);
        this.push(request);
      }
      this.onConnect();
      let envelope;
      while ((envelope = this._sendBuffer.shift()) && this.isConnected()) {
        this.push(envelope);
      }
      this.watchIdle();
    } else {
      this.close();
    }
  }
github swimos / swim / swim-system-js / swim-mesh-js / @swim / client / main / host / WebSocketHost.ts View on Github external
protected onWebSocketMessage(message: MessageEvent): void {
    const data = message.data;
    if (typeof data === "string") {
      const envelope = Envelope.parseRecon(data);
      if (envelope) {
        this.onEnvelope(envelope);
      } else {
        this.onUnknownEnvelope(data);
      }
    }
  }

@swim/warp

WebSocket protocol for dynamically multiplexing large numbers of bidirectional links to streaming API endpoints, called lanes, of URI-addressed distributed objects, called nodes, that run stateful distributed processes, called Web Agents

Apache-2.0
Latest version published 5 months ago

Package Health Score

68 / 100
Full package analysis