Why am I not seeing messages in my subscriber when I publish a message from my Ruby script?

If you are just publishing a message and then exiting (terminating) the Ruby script, you need to add http_sync parameter set to true in the publish call:

pubnub.publish(
    :http_sync => true,
    :channel  => 'the_channel',
    :message => 'Publish with http_sync = true',
) { |data| puts data.response }

The reason the publish does not get sent is because, by default, Ruby operations are asynchronous (they won’t block). This provides the opportunity for the script to terminate before the asynchronous publish call can complete. So http_sync set to true forces the publish to block until completed. If the script does not terminate after the publish then this is not necessary.

In older versions of the PubNub Ruby SDK (v3.3.x, for example), it was blocking by default.