Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task] <support monitoring WebSocket metrics> #1393

Open
2 tasks
tomsun28 opened this issue Dec 6, 2023 · 14 comments · Fixed by #1413
Open
2 tasks

[Task] <support monitoring WebSocket metrics> #1393

tomsun28 opened this issue Dec 6, 2023 · 14 comments · Fixed by #1413
Assignees

Comments

@tomsun28
Copy link
Contributor

tomsun28 commented Dec 6, 2023

Description

support monitoring WebSocket metrics, available, response time and more.

Task List

  • support monitoring WebSocket metrics
  • add help doc
@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

I made a request through the Java. net. Socket class, but its connect method seems to be unable to set a timeout,
Here are the relevant discussions
https://stackoverflow.com/questions/12976608/whats-the-connection-timeout-of-a-socket-created-with-a-connecting-constructor
image

@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

https://github.com/TooTallNate/Java-WebSocket
This is also an option

@tomsun28
Copy link
Contributor Author

tomsun28 commented Dec 9, 2023

Hi we can consider not supporting users to set connect timeout. About thrid library, it's up to you to decide whether to use it.👍

@tomsun28
Copy link
Contributor Author

tomsun28 commented Dec 9, 2023

hi how about use java websocket api instead of socket.
tcp protocol -> http protocol -> websocket protocol
maybe like this, i am not sure it's ok.

   WebSocketClient client = new WebSocketClient();
   container.connectToServer(client, new URI(uri));

@hertzbeat
Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


hi how about use java websocket api instead of socket.
tcp protocol -> http protocol -> websocket protocol
maybe like this, i am not sure it's ok.

   WebSocketClient client = new WebSocketClient();
   container.connectToServer(client, new URI(uri));

@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

hi how about use java websocket api instead of socket. tcp protocol -> http protocol -> websocket protocol maybe like this, i am not sure it's ok.

   WebSocketClient client = new WebSocketClient();
   container.connectToServer(client, new URI(uri));

The socket I'm using returns the following, I can try replacing it with websocket

image

@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

hi how about use java websocket api instead of socket. tcp protocol -> http protocol -> websocket protocol maybe like this, i am not sure it's ok.

   WebSocketClient client = new WebSocketClient();
   container.connectToServer(client, new URI(uri));

The websocket seems to be asynchronous and cannot confirm whether it is appropriate to store the serverHandshake response in the map

@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

hi how about use java websocket api instead of socket. tcp protocol -> http protocol -> websocket protocol maybe like this, i am not sure it's ok.

   WebSocketClient client = new WebSocketClient();
   container.connectToServer(client, new URI(uri));

The websocket seems to be asynchronous and cannot confirm whether it is appropriate to store the serverHandshake response in the map
If I use CountDownLatch to wait, it will keep blocking, I don't know why
image

@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

hi how about use java websocket api instead of socket. tcp protocol -> http protocol -> websocket protocol maybe like this, i am not sure it's ok.

   WebSocketClient client = new WebSocketClient();
   container.connectToServer(client, new URI(uri));

The websocket seems to be asynchronous and cannot confirm whether it is appropriate to store the serverHandshake response in the map
If I use CountDownLatch to wait, it will keep blocking, I don't know why
image

Import error..

@tomsun28
Copy link
Contributor Author

tomsun28 commented Dec 9, 2023

hi try the uri like this String uri = "ws://localhost:8080/your-websocket-endpoint";

@tomsun28
Copy link
Contributor Author

tomsun28 commented Dec 9, 2023

image

👍👍 Great!It's work, you decide which one way we use.

@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

hi try the uri like this String uri = "ws://localhost:8080/your-websocket-endpoint";

You're right, it's true that I wrote the wrong uri,It works
image
and nedd the dependency

        <dependency>
            <groupId>org.java-websocket</groupId>
            <artifactId>Java-WebSocket</artifactId>
            <version>1.5.2</version>
            <scope>compile</scope>
        </dependency>

@ZY945
Copy link
Member

ZY945 commented Dec 9, 2023

image

👍👍 Great!It's work, you decide which one way we use.

Extra packages needed to be introduced, and at the same time it seemed that there wasn't enough information to get the handshake, so I used the socket
image

@tomsun28
Copy link
Contributor Author

tomsun28 commented Dec 9, 2023

Extra packages needed to be introduced, and at the same time it seemed that there wasn't enough information to get the handshake, so I used the socket !

👍👍!

@tomsun28 tomsun28 linked a pull request Dec 11, 2023 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants