How to run stream_from synchronously?

      stream_from "hello world"
      ActionCable.server.broadcast "hello world", { message: "hello rails" }

This channel doesn’t receive a message sometimes, in my opinion, because pubsub.subscribe in stream_from run asynchronously. So how can i run this code synchronously by a smart way?