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

Respond to websocket pings #47696

Open
jkarneges opened this issue Apr 29, 2021 · 1 comment
Open

Respond to websocket pings #47696

jkarneges opened this issue Apr 29, 2021 · 1 comment

Comments

@jkarneges
Copy link
Member

It would be nice if Pushpin could automatically respond to ping messages rather than forwarding to the backend. Ideally this would work for not just literal PING frames, but also TEXT frames with ping-like content. Messages not considered to be pings should still be forwarded to the backend for handling.

@jkarneges
Copy link
Member Author

One way to achieve this in a generic way could be to introduce an "auto response" feature. The backend could send a control message telling Pushpin how to identify a certain kind of message, and what to respond with if such a message is identified. Then that feature could be used to set up an auto response for messages identified as pings.

The tricky part would be specifying how to identify messages. For an initial version, perhaps we could support only JSON content, and use something like JSON Pointer to describe what to expect. There is some precedence with using JSON Pointer in Pushpin already, in the session feature (undocumented).

Example GRIP control messages below.

Respond to PING message with PONG message:

{"type": "auto-respond", "match-message-type": "ping", "message-type": "pong", "content": ""}

Respond to TEXT message {"type": "ping"} with TEXT message {"type": "pong"}:

{"type": "auto-respond", "match-content-ptr": "/type", "content-expect": "ping", "content": "{\"type\": \"pong\"}"}

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

1 participant