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

[QUESTION] Is it possible to configure websocket server to return different results #459

Closed
toerni opened this issue Jun 23, 2023 · 6 comments
Assignees
Labels

Comments

@toerni
Copy link

toerni commented Jun 23, 2023

Stubby websocket server can be configured to return a certain response on connection time.
With the delay, you can specifiy how much time passes between each send
However, I can't get stubby to send a different response every time the delay passes.
Eg., after a second send response 1, after two seconds, send response 2 en after 3 seconds a third response

@github-actions
Copy link

Thanks for opening your first issue. Pull requests are always welcome too! :)

@azagniotov
Copy link
Owner

Hey @toerni ,

Thank you for the question.

Unfortunately, although this is supported in stubby4j on HTTP (I am quoting stubby's HTTP docs Response object properties section):

When sequenced responses is configured, on each incoming request to the same URI,
a subsequent response in the list will be sent to the client. The sequenced responses
play in a cycle (loop). In other words: after the response sequence plays through,
the cycle restarts on the next incoming request.

I do not have an equivalent functionality for web sockets ... I can try to find a time next week to make a PR

@Kamali20-gan
Copy link

Hi, I need this feature for my automation as well .. Has this been implemented ?
Thanks

@Kamali20-gan
Copy link

I guess we can achieve this by configuring on-message for the client to send a particular message and upon receiving that message we can send the desired response .. But our automation is in python and am trying to figure out how to send a WebSocket message to admin portal from python code .. any help or tips to achieve this is really appreciated :)

@azagniotov
Copy link
Owner

Started work

@azagniotov
Copy link
Owner

Done. Please have a look: https://stubby4j.com/docs/websockets_configuration_howto.html#server-response-required

I will try to release the v7.6.1 in the next few days to Maven Central and DockerHub. In the meanwhile, this is available in the latest tag on DockerHub

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

No branches or pull requests

3 participants