qbits.jet.client.websocket

->Connection

(->Connection client request socket)

Positional factory function for class qbits.jet.client.websocket.Connection.

connect!

(connect! url handler & [{:as options, :keys [in out ctrl executor ssl-context-factory async-write-timeout connect-timeout max-idle-timeout max-binary-message-buffer-size max-text-message-buffer-size daemon?], :or {in async/chan, out async/chan, ctrl async/chan}}])

Takes an url a handler, an option map and returns a websocket client.

The option map can take the following keys:

  • :executor - java.util.concurrent.Executor instance
  • :ssl-context-factory - SSLContextFactory instance to be use to perform wss requests http://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/util/ssl/SslContextFactory.html
  • :in - fn that returns the :in channel that the handler will receive - defaults to c.core.async/chan
  • :out - fn that returns the :in channel that the handler will receive - defaults to c.core.async/chan
  • :ctrl - fn that returns the :in channel that the handler will receive - defaults to c.core.async/chan

The handler receives a map of:

  • :in - core.async chan that receives data sent by the client
  • :out - core async chan you can use to send data to client, or close the connection by closing the channel
  • :ctrl - core.asyn chan that received control messages such as: `[::error e], [::close reason]
  • :ws - qbits.jet.websocket/WebSocket instance

map->Connection

(map->Connection m__5869__auto__)

Factory function for class qbits.jet.client.websocket.Connection, taking a map of keywords to field values.