How to use the sockjs-client.OPEN function in sockjs-client

To help you get started, we’ve selected a few sockjs-client 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 researchstudio-sat / webofneeds / webofneeds / won-owner-webapp / src / main / webapp / app / messaging-agent.js View on Github external
const sendFirstInBuffer = function(newMsgBuffer) {
      if (newMsgBuffer && !newMsgBuffer.isEmpty()) {
        try {
          const firstEntry = newMsgBuffer.entries().next().value;
          if (firstEntry && ws.readyState === SockJS.OPEN) {
            //undefined if queue is empty
            if (firstEntry.length != 2) {
              console.error(
                "Could not send message, did not find a uri/message pair in the message buffer. The first Entry in the buffer is:",
                firstEntry
              );
              return;
            }
            const [eventUri, msg] = firstEntry;
            ws.send(JSON.stringify(msg));
            //console.log("messaging-agent.js: sent message: " + JSON.stringify(msg));

            // move message to next stat ("waitingForAnswer"). Also triggers this watch again as a result.
            redux.dispatch(
              actionCreators.messages__waitingForAnswer({ eventUri, msg })
            );
github Coding / WebIDE-Frontend / app / dashboard / api / socket.js View on Github external
const error = (frame) => {
            switch (this.ws.readyState) {
                case SockJS.CLOSING:
                case SockJS.CLOSED:
                    this.reconnect();
                    break;
                case SockJS.OPEN:
                default:
                    console.log('FRAME ERROR', frame);
                    this.errorCallback(frame);
            }
        };
        const headers = this.headers || {};
github QuantumMechanics / NEM-sdk / src / com / websockets / account.js View on Github external
let checkReadyState = function(connector) {
    var self = connector;
    if (SockJSBrowser ? self.socket.readyState !== SockJSBrowser.OPEN : self.socket.readyState !== SockJSNode.OPEN) {
        return false;
    } 
    return true;
}
github taskagile / vuejs.spring-boot.mysql / front-end / src / real-time-client.js View on Github external
_isConnected () {
    return this.socket && this.socket.readyState === SockJS.OPEN
  }
  _onConnected () {
github Coding / WebIDE-Frontend / app / backendAPI / websocketClients.js View on Github external
const error = (frame) => {
      log('fsSocket error', this.socket)
      switch (this.socket.readyState) {
        case SockJS.CLOSING:
        case SockJS.CLOSED:
          runInAction(() => config.fsSocketConnected = false)
          this.reconnect()
          break
        case SockJS.OPEN:
          log('FRAME ERROR', frame)
          break
        default:
      }
      this.errorCallback(frame)
    }

sockjs-client

SockJS-client is a browser JavaScript library that provides a WebSocket-like object.

MIT
Latest version published 3 years ago

Package Health Score

81 / 100
Full package analysis