Sha256: 37d0e4ef1186dae217e027331c4bfa9d6296b0169a0f7f74c3c509edb0d82890
Contents?: true
Size: 600 Bytes
Versions: 4
Compression:
Stored size: 600 Bytes
Contents
module Phoenix class Socket include Native alias_native :connect def initialize(url, params = {}) super(`new Phoenix.Socket(#{url.to_s}, #{params.to_n})`) end def channel(topic, params = {}) chan = Channel.new(topic, params, @native) `#{@native}.channels.push(#{chan.to_n})` chan end def on_error(&block) `#{@native}.onError(#{callback(block)})` end def on_close(&block) `#{@native}.onClose(#{callback(block)})` end def callback(block) proc do |e| block.call(Native(e)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opal-phoenix-0.0.8 | opal/phoenix/socket.rb |
opal-phoenix-0.0.7 | opal/phoenix/socket.rb |
opal-phoenix-0.0.6 | opal/phoenix/socket.rb |
opal-phoenix-0.0.5 | opal/phoenix/socket.rb |