Hi everyone,
I want to have a process subscribe to a pubsub topic, and when it gets a message from the topic, send that message across a websocket to a browser window (or processing or similar ). There is no information flow in the other direction. I think browser window will be easiest as I do not have to invent any protocols.
This seems like it should be simple? I’m not running a web app so I don’t want to make all of phoenix my dependency if I don’t have to. I saw three websocket libraries - websockex, cowboy websocket, and phoenix channel.
I’m going to write my own websocket message processor on the browser side that takes the messages and converts them into drwaings on the screen.
What’s the easiest way for an elixir newbie to do this? Something like:
defmodule Drawing
use WebSocket # for websockex
def start_link do
Pheonix.PubSub.subscribe :pubsub, "topic"
WebSocket.start_link("https://localhost:4000/ws")
loop()
end
def loop do
receive do
_ -> Websocket.send( .... ??? )
end
end
end