zelloptt / zello-channel-api

WebSocket-based API and SDKs to connect to Zello channels (BETA)
MIT License
88 stars 35 forks source link

WebSocket connection to 'wss://zello.io/ws/' failed #164

Closed codymatthew closed 2 years ago

codymatthew commented 2 years ago

I am getting the following errors when loading the code below. I have not maxed out the connections, I waited over 24 hours before running the code again and I'm getting the same error. The error is reproduced both locally and from a https website.

Edge: WebSocket connection to 'wss://zello.io/ws/' failed: Error during WebSocket handshake: Unexpected response code: 429

Chrome: WebSocket connection to 'wss://zello.io/ws/' failed: value @ zcc.session.js:1 value @ zcc.session.js:1 value @ zcc.session.js:1 (anonymous) @ (index):32 (anonymous) @ (index):30 (anonymous) @ zcc.sdk.js:1 (anonymous) @ zcc.sdk.js:1 R.r.promiseDispatch @ zcc.sdk.js:1 (anonymous) @ zcc.sdk.js:1 f @ zcc.sdk.js:1 s @ zcc.sdk.js:1 (anonymous) @ zcc.sdk.js:1 y @ zcc.sdk.js:1 c @ zcc.sdk.js:1

<script src="https://zello.io/sdks/js/latest/zcc.sdk.js"></script>
    <script>
    var defaultServerURL = 'wss://zello.io/ws/';
      function start() {
        ZCC.Sdk.init({
          player: true,
          recorder: true,
          encoder:  true,
          widget: false
        }).then(function() {
          var sessions = [
            {
              isConnected: false,
              ChTitle: 'xxx',
              session: new ZCC.Session({
                serverUrl: defaultServerURL,
                channel: 'xxx',
                authToken: 'xxx'
              })
            },
            {
              isConnected: false,
              ChTitle: 'xxx',
              session: new ZCC.Session({
                serverUrl: defaultServerURL,
                channel: 'xxx',
                authToken: 'xxx'
              })
            },
            {
              isConnected: false,
              ChTitle: 'xxx',
              session: new ZCC.Session({
                serverUrl: defaultServerURL,
                channel: 'xxx',
                authToken: 'xxx'
              })
            },
            {
              isConnected: false,
              ChTitle: 'xxx',
              session: new ZCC.Session({
                serverUrl: defaultServerURL,
                channel: 'xxx',
                authToken: 'xxx'
              })
            },
            {
              isConnected: false,
              ChTitle: 'xxx',
              session: new ZCC.Session({
                serverUrl: defaultServerURL,
                channel: 'xxx',
                authToken: 'xxx'
              })
            }
          ];
            sessions.forEach((s, id) => {
              s.session.connect(function(err, result) {
                if (err) {
                  s.isConnected = false;
                  document.body.innerHTML = "Ch Disconnected: " + sessions[id].ChTitle + "<br>" + document.body.innerHTML;
                  return
                }
                s.isConnected = true;
                document.body.innerHTML = "Ch Connected: " + sessions[id].ChTitle + "<br>" + document.body.innerHTML;
              });
              s.session.on(ZCC.Constants.EVENT_INCOMING_VOICE_WILL_START, function(incomingMessage) {
                document.body.innerHTML = "Audio Started Channel " + sessions[id].ChTitle + "<br>" + document.body.innerHTML;
                incomingMessage.on(ZCC.Constants.EVENT_INCOMING_VOICE_DID_STOP, function() {
                  document.body.innerHTML = "Audio Ended Channel " + sessions[id].ChTitle + "<br>" + document.body.innerHTML;
                });
              });
            });
        }).catch(function(err) {
          console.trace(err);
        })
      }
    </script>