Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use websocket

Shulou Source: shulou.com Published: 2022-06-01 01:55:55 09月16日 Update

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.

Tags: Content service run configuration code customer client article knowledge article agent frequency event value usage public welfare just background address most Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux Apple Redmi vpn