Documentation ¶
Index ¶
- type HapiJS
- func (hapi *HapiJS) Connect(this js.Value, args []js.Value) interface{}
- func (hapi *HapiJS) Disconnect()
- func (hapi *HapiJS) Login(this js.Value, args []js.Value) interface{}
- func (hapi *HapiJS) Ping(this js.Value, args []js.Value) interface{}
- func (hapi *HapiJS) PubEvent(this js.Value, args []js.Value) interface{}
- func (hapi *HapiJS) SubActions(this js.Value, args []js.Value) interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HapiJS ¶
type HapiJS struct {
// contains filtered or unexported fields
}
HapiJS provides JS callable methods to the Hub using a websocket connection to the Hub
func NewHubAPI ¶
func NewHubAPI() *HapiJS
NewHubAPI returns a new HapiJS instance. connect() must be called first
func (*HapiJS) Connect ¶
Connect to the Hub and create the gateway capnp client. Use login to authenticate. Note that auto-discovery must be handled on the JS side as nodejs doesn't allow DNS-SD through wasm. This returns a promise to avoid deadlock.
args[0] serviceID, also used as publisherID. Must match CN field in client cert args[1] fullURL is the full websocket address, eg: wss://addr:port/ws args[2] clientCertPem with client certificate for client authentication args[3] clientKeyPem with client key for client authentication args[4] caCertPem with CA's certificate for server authentication
func (*HapiJS) Login ¶
Login is the async method to login to the gateway This is an alternate way to authenticate in case a client certificate is not available.
args[0] = loginID string args[1] = password string
func (*HapiJS) Ping ¶
Ping is the async method to ping the gateway This does not require authentication.
func (*HapiJS) PubEvent ¶
PubEvent Async method for publishing the events This obtains the service pubsub capability from the gateway and publishes the event. This capability is only available when using certificate authentication as it is intended for services.
args[0] = thingID args[1] = event name args[2] = event data serialized
func (*HapiJS) SubActions ¶
SubActions Async method for subscribing to all actions of a given thing, or all things. This obtains the service pubsub capability from the gateway and subscribes to actions. This capability is only available when using certificate authentication as it is intended for services.
args[0] = callback handler to invoke: (publisher ID, thingID, actionName, actionValue)