Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use websocket

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge of this article "how to use websocket", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can gain something after reading this article. Let's take a look at this "how to use websocket" article.

Use the method git clone https://github.com/diaozxin007/DingTalkProxycd DingProxyServer./gradlew buildjava-jar build/libs/dingWs-all.jar# if you need to run nohup java-jar build/libs/dingWs-1.0.0-all.jar & > nohup.out & tailf nohup.out in the background

You can modify the server.properties under resources

# listen on the uriserver.api=/ding/api of port server.port=8080# nail callback

Then rerun:

. / gradlew build

By this time, proxy is already running normally.

If you just want to see the message of the pin callback, you can use [websock-test] (http://www.websocket-test.com/) GUI debugging tool) directly.

If you want to use it in the code, you can refer to the code in DingProxyClinet.

Matters needing attention

Why can't I connect to the service?

A: confirm whether only https is enabled for the service. If https is enabled, the protocol header needs to be changed to wss.

Am I still unable to connect?

A: you need to confirm the configuration of nginx and whether WebSocket is supported.

Can be added to the configuration of nginx

Proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "Upgrade"; # if the timeout is disconnected frequently, you can configure proxy_connect_timeout 7d

Besides acting as an agent for nailing, what else can I do?

A: in theory, you can proxy all requests, and then convert them to String and push them to the client through WebSocket.

I am too lazy to deploy the service.

A: you can use the public service I provide

Enter in the callback API:

Https://api.xilidou.com/ding/api

The WebSocket address is:

Wss://api.xilidou.com

To prevent abuse, each client can only receive 10 messages at a time and then be disconnected.

The above is about the content of this article on "how to use websocket". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report