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

Websocket Handshake error #26

Open
miteshp22 opened this issue Sep 12, 2023 · 3 comments
Open

Websocket Handshake error #26

miteshp22 opened this issue Sep 12, 2023 · 3 comments

Comments

@miteshp22
Copy link

Hi we are using a websocket API and have a thread that will refresh the connection every hour, and also another thread that will process the logs on a interval that is specified in our fluentd config

We integrated this gem into our fluentd plugin, but we are seeing the following handshake error where we notice afterwards it does not process logs as indicated in our container logs (although it does output one record constantly to our file and switches to another record and so and so)

DEBUG -- : --- WSS Error #<WebSocket::Error::Handshake::InvalidStatusCode: WebSocket::Error::Handshake::InvalidStatusCode>

Do you happen to have any insight on this particular error?

@unasuke
Copy link
Collaborator

unasuke commented Sep 13, 2023

I cannot judge that this gem's issue or not from your information.
What was the status code returned from the WebSocket server? For the investigation, the error code is important.

@miteshp22
Copy link
Author

Hi unfortunately, we do not own the server and it is difficult to reproduce the issue as it occurs every now and then but it seems our connection refresh handles it. Although, I will see if I can get the error code still from server side.

To pivot, I have another question:
Inside the ws.on loop where it opens the websocket and grabs data. We are unable to use any fluentd related native methods such as router.emit to write this message to a file. We beleive it is because the ws.on is actually opening another thread and the fluentd context is gone. Is there a way to use fluentd methods inside the ws.on loop?

@unasuke
Copy link
Collaborator

unasuke commented Sep 18, 2023

Is there a way to use fluentd methods inside the ws.on loop?

It was not easy for me to figure out how to do this. It might be feasible through inter-process communication, for example. Or you may need to use the websocket gem directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants