Crossbar HTTP

Gem Version Circle CI Codecov

Module that provides methods for accessing HTTP Bridge Services

Revision History

  • v0.1.3:
    • Removed dependency on Ruby 2.3
  • v0.1.2:
    • Added the ability to override the date serialization
  • v0.1.1:
    • Fixed typos in README
    • Added support for https
  • v0.1.0:
    • Initial version


gem 'crossbar-http'



To call a Crossbar HTTP bridge, do the following

client ="")
result ="com.example.add", 2, 3, offset: 10)

This will call the following method

def onJoin(self, details):

    def add_something(x, y, offset=0):
        print "Add was called"
        return x+y+offset

    self.register(add_something, "com.example.add")


To publish to a Crossbar HTTP bridge, do the following

client ="")
result = client.publish("com.example.event", event: "new event")

The receiving subscription would look like

def onJoin(self, details):

    def subscribe_something(event=None, **kwargs):
        print "Publish was called with event %s" % event

    self.subscribe(subscribe_something, "com.example.event")


For bridge services that have a key and secret defined, simply include the key and secret in the instantiation of the client.

client ="", key: "key", secret: "secret")

Pre-Serialize Callback

The library provides a "pre-serialize" callback which will allow the user to modify certain object types before the payload is serialized. This can be used for things like changing the date/time to a custom value. See an example of doing this below

pre_serialize = lambda { |value|
  if value.is_a? Date
    return value.strftime("%Y/%m/%d %H:%M:%S.%L %Z")
client ="", pre_serialize: pre_serialize)


To contribute, fork the repo and submit a pull request.


To run the unit tests, execute the following

%> rake spec