Skip to content

How to use as just a Websocket server (for browser/mobile client)? #7

Answered by orweis
lefnire asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @lefnire - I'm super happy you see the value in this package.
And yes this can definitely work well for mobile, web, and even edge / IoT- the network layout and protocol are designed for scale out cases. - We're even thinking of creating JS clients in the future (though no immediate plans yet).

To the specific question:

"how, just on the FastAPI server, can I both subscribe to messages from the browser, and publish things back?"

You're pseudo-code is not far off, just need to add a callback ;-)

You have two options to add subscribing logic at the backend:

  • Subscribing directly to the event notifier (you can already do it via endpoint.notifier.subscribe(id, topics, callback) but I just…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Faridalim
Comment options

@orweis
Comment options

Answer selected by orweis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #5 on March 10, 2021 11:11.