How to use rsocket-websocket-server - 5 common examples

To help you get started, we’ve selected a few rsocket-websocket-server 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 rsocket / rsocket-js / packages / rsocket-examples / src / SimpleCli.js View on Github external
function getServerTransport(protocol: string, options: ServerOptions) {
  switch (protocol) {
    case 'tcp':
    default:
      return new RSocketTCPServer({...options});
    case 'ws':
      return new RSocketWebSocketServer({...options});
  }
}
github scalecube / scalecube-js / packages / rsocket-ws-gateway / src / Gateway.ts View on Github external
constructor(opts: GatewayOptions) {
    const { port } = opts;
    this.port = port || 3000;
    this.transport = new RSocketWebSocketServer({ port: this.port });
    const { requestResponse: optRequestResponse, requestStream: optRequestStream } = opts;
    validateCustomHandlers('requestResponse', optRequestResponse);
    validateCustomHandlers('requestStream', optRequestStream);

    this.requestResponse = optRequestResponse;
    this.requestStream = optRequestStream;
  }
github rsocket / rsocket-js / packages / rsocket-examples / src / SimpleServer.js View on Github external
function getTransport(protocol: string, options: ServerOptions) {
  switch (protocol) {
    case 'tcp':
      return new RSocketTCPServer({...options});
    case 'ws':
    default:
      return new RSocketWebSocketServer({...options});
  }
}
github scalecube / scalecube-js / packages / scalecube-transport / src / provider / RSocketServerProvider.js View on Github external
}
                          },
                          error => subscriber.onError(error),
                          () => subscriber.onComplete()
                        );
                      }

                      updates++;
                    }
                  });
                });
              }
            };
          },
          serializers: JsonSerializers,
          transport: new RSocketWebSocketServer(serverConfig)
        });
        this._server.start();
      } catch(error) {
        reject(errors.cantStartServer)
      }
      return resolve();
    })
github scalecube / scalecube-js / packages / scalecube-transport / src / server / server.js View on Github external
subscriber.onComplete();
                      }
                    } else {
                      subscriber.onNext({ data: getTextResponseMany(index++)(data) });
                    }
                  }, 100);
                }
              }
            }
          });
        });
      }
    };
  },
  serializers: JsonSerializers,
  transport: new RSocketWebSocketServer({
    protocol: 'ws',
    host: '0.0.0.0',
    port: 8080
  })
});

export const startServer = () => server.start();

export const stopServer = () => server.stop();

rsocket-websocket-server

RSocket WebSocket server

Apache-2.0
Latest version published 10 months ago

Package Health Score

72 / 100
Full package analysis

Popular rsocket-websocket-server functions

Similar packages