Documentation ¶
Overview ¶
Package pitays only exists to register the pitaya extension
Index ¶
- type Client
- func (c *Client) Connect(addr string) error
- func (c *Client) ConsumePush(route string, timeoutMs int) *goja.Promise
- func (c *Client) Disconnect()
- func (c *Client) IsConnected() bool
- func (c *Client) Notify(route string, msg interface{}) error
- func (c *Client) Request(route string, msg interface{}) *goja.Promise
- type ModuleInstance
- type Response
- type RootModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the pitaya client It is used to connect to a pitaya server and send requests and notifies It is also used to consume pushes
func (*Client) Connect ¶
Connect connects to the server addr is the address of the server to connect to
func (*Client) ConsumePush ¶
ConsumePush will return a promise that will be resolved when a push is received on the given route. The promise will be rejected if the timeout is reached before a push is received. The promise will be resolved with the push data.
func (*Client) IsConnected ¶
IsConnected returns true if the client is connected to the server
func (*Client) Notify ¶
Notify sends a notify to the server route is the route to send the notify to msg is the message to send returns an error if the notify could not be sent
type ModuleInstance ¶
type ModuleInstance struct { *Client // contains filtered or unexported fields }
ModuleInstance represents an instance of the JS module.
func (*ModuleInstance) Exports ¶
func (mi *ModuleInstance) Exports() modules.Exports
Exports implements the modules.Instance interface and returns the exports of the JS module.
func (*ModuleInstance) NewClient ¶
func (mi *ModuleInstance) NewClient(call goja.ConstructorCall) *goja.Object
NewClient is the JS constructor function for the Client type. It returns a new Client instance for each VU. The first argument is an options object with the following fields: - handshakeData: the handshake data to send to the server - requestTimeoutMs: the timeout for requests in milliseconds - logLevel: the log level to use
type Response ¶
type Response interface{}
Response is the type of the response returned by the server
type RootModule ¶
type RootModule struct{}
RootModule is the global module instance that will create Client instances for each VU.
func (*RootModule) NewModuleInstance ¶
func (*RootModule) NewModuleInstance(vu modules.VU) modules.Instance
NewModuleInstance implements the modules.Module interface and returns a new instance for each VU.