Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
332 views
in Technique[技术] by (71.8m points)

javascript - Socket IO Client won't connect to Streamlabs Server

I just started working with the Socket IO library and I pulled this fairly simple code off the internet, and it doesn't see to connect to the Streamlabs server. It just outputs 5 and then outputs ping timeout every 30 seconds afterwards. (Pulled some of the code from this example: https://dev.streamlabs.com/docs/socket-api)

const streamlabs = io(`https://sockets.streamlabs.com?token=${socketToken}`, {transports: ['websocket']});
  

streamlabs.on("connect", () => {
    console.log(10)
});

streamlabs.on("disconnect", (reason) => {
  console.log(reason)
});
console.log(5)```
question from:https://stackoverflow.com/questions/65912690/socket-io-client-wont-connect-to-streamlabs-server

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

read the dcoumentation, first of all you should get socketToken You can get started with the Streamlabs API in three simple steps.

  1. Register your application
  2. Connect user(s) to your account
  3. Use your access_token and execute API calls

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...