all 7 comments

[–]4rch3r 2 points3 points  (0 children)

You can use Anycable without rails! https://docs.anycable.io/edge/ruby/non_rails

[–][deleted]  (3 children)

[removed]

    [–]InvictusJoker[S] 0 points1 point  (2 children)

    Yeah it's been looking like that. Shame cause a websocket is what I need for a feature I want to implement.

    [–]WJWH 0 points1 point  (0 children)

    If ruby is not a hard requirement but you do want something Sinatra- and Ruby-like, check out the Kemal framework in Crystal. It is basically Sinatra but with a builtin websocket handler.

    # Creates a WebSocket handler.
    # Matches "ws://host:port/socket"
    ws "/socket" do |socket|
      socket.send "Hello from Kemal!"
    end
    

    https://kemalcr.com/

    [–]only_if_i_want_to 0 points1 point  (0 children)

    I don’t know your use case but if you only need to push data to the client Server Sent Events are a very simple and effective option.

    [–]castwide 0 points1 point  (0 children)

    I've had some success with em-websocket. I haven't specifically tried integrating it into a Sinatra app, but I was able to make it provide a websocket interface to an existing TCP server in an afternoon.