Documentation ¶
Index ¶
Constants ¶
const ( // InternalAPIs service pool of sockets this message applies to InternalAPIs service = iota // Commentron service pool of sockets this message applies to Commentron // BlockChain service pool of sockets for monitoring blockchain stream BlockChain )
const ( // Viewers monitors viewers messages that show connection count Viewers = Monitor("viewers") // Deltas monitors the new comments coming in. Deltas = Monitor("delta") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *http.Client WebSockets []WebSocketClient // contains filtered or unexported fields }
Client sockety client for making calls to sockety api
func (*Client) Listen ¶
func (c *Client) Listen(params WebSocketClientParams) error
Listen connects and listens for websocket messages.
func (Client) SendNotification ¶
func (c Client) SendNotification(args SendNotificationArgs) (*SendNotificationResponse, error)
SendNotification sends a notification to a service's connected socket
type Monitor ¶
type Monitor string
Monitor describes the type of messages of a service that you would like to listen for.
type SendNotificationArgs ¶
type SendNotificationArgs struct { Service service Type string IDs []string Category *string SubCategory *string Data map[string]interface{} }
SendNotificationArgs Arguments for sending funds via dispendium
type SendNotificationResponse ¶
type SendNotificationResponse struct { *http.Response Success bool `json:"success"` Error *string `json:"error"` Data *SendNotificationResult `json:"data,omitempty"` Trace []string `json:"_trace,omitempty"` }
SendNotificationResponse response from the api call. It includes the http response plus the result
type SendNotificationResult ¶
type SendNotificationResult struct { LBCAmount float64 `json:"lbc_amount"` SatoshiAmount uint64 `json:"satoshi_amount"` TxHash string `json:"tx_id"` }
SendNotificationResult result from the api call to send funds
type ViewersMsg ¶
type ViewersMsg struct {
Connected int `json:"connected"`
}
ViewersMsg Message showing how many users are connected to sockety for the specific ID.
func ToViewersMsg ¶
func ToViewersMsg(n *push.Notification) (ViewersMsg, error)
ToViewersMsg extracts ViewersMsg from Notification
type WebSocketClient ¶
type WebSocketClient interface { Connect() error OnMessage([]byte) error OnClose() error OnOpen() error OnError(error) SendMessage([]byte) error }
WebSocketClient connection client
type WebSocketClientParams ¶
type WebSocketClientParams struct { Service service ID string OnMessageFn func(notification *push.Notification) OnCloseFn func() OnOpenFn func() OnErrorFn func(err error) Monitors []Monitor }
WebSocketClientParams parameters to listen to a websocket subscription