Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Information *map[string]interface{} Locale string Token string Connection *websocket.Conn Channel chan string }
A Client will connect to the Olivia's server using the Token the Information and the Locale
func NewClient ¶
func NewClient(host string, ssl bool, information *map[string]interface{}) (client Client, err error)
NewClient creates a new Client by generating a random token, and setting english as the default langauge. You need to give a pointer of the information map of your client. The host is also required with a boolean, if the SSL certificate is required.
func (*Client) SendMessage ¶
func (client *Client) SendMessage(content string) (ResponseMessage, error)
SendMessage sends the given content to the websocket of Olivia and returns her response with an error.
type RequestMessage ¶
type RequestMessage struct { Type int `json:"type"` // 0 for handshakes and 1 for messages Content string `json:"content"` Token string `json:"user_token"` Information map[string]interface{} `json:"information"` Locale string `json:"locale"` }
RequestMessage is the structure that uses entry connections to chat with the websocket
type ResponseMessage ¶
type ResponseMessage struct { Content string `json:"content"` Tag string `json:"tag"` Information map[string]interface{} `json:"information"` }
ResponseMessage is the structure used to reply to the user through the websocket
Click to show internal directories.
Click to hide internal directories.