Qore WebSocketClient Module Reference  1.7
WebSocketClient::WebSocketConnectionObject Class Reference

class for websocket connections; returns an object of class WebSocketClient for receiving websocket events from a websocket server More...

Inheritance diagram for WebSocketClient::WebSocketConnectionObject:

Public Member Methods

deprecated constructor (string name, string desc, string url, bool monitor, *hash opts, hash urlh)
 DEPRECATED: creates the WebSocketConnectionObject object. More...
 
 constructor (string name, string description, string url, hash attributes={}, hash options={})
 creates the WebSocketConnectionObject connection object More...
 
*hash getDefaultOptions ()
 returns default options
 
hash getOptions ()
 gets options
 
*hash getRuntimeOptions ()
 returns runtime options More...
 
string getType ()
 returns "websocket"
 

Static Public Member Methods

static deprecated WebSocketConnectionObject make (string name, string desc, string url, bool monitor, *hash opts, hash urlh)
 DEPRECATED: static constructor. More...
 

Private Member Methods

hash< ConnectionConstructorInfo > getConstructorInfoImpl ()
 returns a hash that can be used to construct the object dynamically More...
 
WebSocketClient getImpl (bool connect=True, *hash rtopts)
 returns a WebSocketClient object More...
 

Detailed Description

class for websocket connections; returns an object of class WebSocketClient for receiving websocket events from a websocket server

supports the following options:

  • "connect_timeout": connection timeout to use in milliseconds
  • "http_version": HTTP version to use ("1.0" or "1.1", defaults to "1.1")
  • "max_redirects": maximum redirects to support
  • "proxy": proxy URL to use
  • "timeout": transfer timeout to use in milliseconds

also supports the following runtime options in getImpl():

  • "callback": (required) a callback to receive websocket events
  • "dbglog": a closure taking a single string for detailed technical connection logging
  • "errlog": a closure accepting a single string for error logging
  • "log": a closure accepting a single string for logging
  • "yield": a closure to yield current thread execution

Member Function Documentation

◆ constructor() [1/2]

deprecated WebSocketClient::WebSocketConnectionObject::constructor ( string  name,
string  desc,
string  url,
bool  monitor,
*hash  opts,
hash  urlh 
)

DEPRECATED: creates the WebSocketConnectionObject object.

Parameters
namethe name of the connection
descconnection description
urlconnection URL
monitormonitoring flag
optsconnection options
urlhbroken down URL hash (as returned by Qore::parse_url())
Deprecated:
since Qore 0.9

◆ constructor() [2/2]

WebSocketClient::WebSocketConnectionObject::constructor ( string  name,
string  description,
string  url,
hash  attributes = {},
hash  options = {} 
)

creates the WebSocketConnectionObject connection object

Parameters
namethe name of the connection
descriptionconnection description
urlconnection URL (potentially with password info)
attributesvarious attributes. See below
optionsconnection options

See AbstractConnection::constructor() for attributes and options reference.

◆ getConstructorInfoImpl()

hash<ConnectionConstructorInfo> WebSocketClient::WebSocketConnectionObject::getConstructorInfoImpl ( )
privatevirtual

returns a hash that can be used to construct the object dynamically

Since
WebSocketClient 1.7

Implements ConnectionProvider::AbstractConnection.

◆ getImpl()

WebSocketClient WebSocketClient::WebSocketConnectionObject::getImpl ( bool  connect = True,
*hash  rtopts 
)
privatevirtual

returns a WebSocketClient object

Parameters
connectif True, then WebSocketClient::connect() is called
rtoptssupports the following runtime options in getImpl():
  • "callback": (required) a callback to receive websocket events
  • "dbglog": a closure taking a single string for detailed technical connection logging
  • "errlog": a closure accepting a single string for error logging
  • "log": a closure accepting a single string for logging
  • "yield": a closure to yield current thread execution
Returns
a WebSocketClient object

Implements ConnectionProvider::AbstractConnection.

◆ getRuntimeOptions()

*hash WebSocketClient::WebSocketConnectionObject::getRuntimeOptions ( )

returns runtime options

Returns
a hash with the following keys reflecting support for the corresponding runtime options in getImpl():
  • "callback": (required) a callback to receive websocket events
  • "dbglog": a closure taking a single string for detailed technical connection logging
  • "errlog": a closure accepting a single string for error logging
  • "log": a closure accepting a single string for logging
  • "yield": a closure to yield current thread execution

◆ make()

static deprecated WebSocketConnectionObject WebSocketClient::WebSocketConnectionObject::make ( string  name,
string  desc,
string  url,
bool  monitor,
*hash  opts,
hash  urlh 
)
static

DEPRECATED: static constructor.

Deprecated:
since Qore 0.9 in favor of new constructor and Qore::Reflection