v0.0.4 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 12 Imported by: 0



Package realtime provides access to Rocket.Chat's realtime API via ddp



This section is empty.


This section is empty.


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

func NewClient

func NewClient(serverURL *url.URL, debug bool) (*Client, error)

NewClient creates a new instance and connects to the websocket.

func (*Client) AddStatusListener

func (c *Client) AddStatusListener(listener func(int))

func (*Client) ArchiveChannel

func (c *Client) ArchiveChannel(roomID string) error

ArchiveChannel archives the channel Takes roomID

func (*Client) Close

func (c *Client) Close()

Close closes the ddp session.

func (*Client) ConnectionAway

func (c *Client) ConnectionAway() error

ConnectionAway sets connection status to away.

func (*Client) ConnectionOnline

func (c *Client) ConnectionOnline() error

ConnectionOnline sets connection status to online.

func (*Client) CreateChannel

func (c *Client) CreateChannel(name string, users []string) error

CreateChannel creates a channel Takes name and users array

func (*Client) CreateGroup

func (c *Client) CreateGroup(name string, users []string) error

CreateGroup creates a private group Takes group name and array of users

func (*Client) DeleteChannel

func (c *Client) DeleteChannel(roomID string) error

DeleteChannel deletes the channel Takes roomId

func (*Client) DeleteMessage

func (c *Client) DeleteMessage(message *models.Message) error

DeleteMessage deletes a message takes a message object

func (*Client) EditMessage

func (c *Client) EditMessage(message *models.Message) error

EditMessage edits a message takes message object

func (*Client) GetChannelID

func (c *Client) GetChannelID(name string) (string, error)

func (*Client) GetChannelRoles

func (c *Client) GetChannelRoles(roomID string) error

GetChannelRoles returns room roles

func (*Client) GetChannelSubscriptions

func (c *Client) GetChannelSubscriptions() ([]models.ChannelSubscription, error)

GetChannelSubscriptions gets users channel subscriptions Optionally includes date to get all since last check or 0 to get all

func (*Client) GetChannelsIn

func (c *Client) GetChannelsIn() ([]models.Channel, error)

GetChannelsIn returns list of channels Optionally includes date to get all since last check or 0 to get all

func (*Client) GetPermissions

func (c *Client) GetPermissions() ([]models.Permission, error)

GetPermissions gets permissions

func (*Client) GetPublicSettings

func (c *Client) GetPublicSettings() ([]models.Setting, error)

GetPublicSettings gets public settings

func (*Client) GetUserRoles

func (c *Client) GetUserRoles() error

GetUserRoles gets current users roles

func (*Client) JoinChannel

func (c *Client) JoinChannel(roomID string) error

JoinChannel joins a channel Takes roomID

func (*Client) LeaveChannel

func (c *Client) LeaveChannel(roomID string) error

LeaveChannel leaves a channel Takes roomID

func (*Client) LoadHistory

func (c *Client) LoadHistory(roomID string) ([]models.Message, error)

LoadHistory loads history Takes roomID

func (*Client) Login

func (c *Client) Login(credentials *models.UserCredentials) (*models.User, error)

Login a user. token shouldn't be nil, otherwise the password and the email are not allowed to be nil.

func (*Client) NewMessage

func (c *Client) NewMessage(channel *models.Channel, text string) *models.Message

NewMessage creates basic message with an ID, a RoomID, and a Msg Takes channel and text.

func (*Client) PinMessage

func (c *Client) PinMessage(message *models.Message) error

PinMessage pins a message takes a message object

func (*Client) ReactToMessage

func (c *Client) ReactToMessage(message *models.Message, reaction string) error

ReactToMessage adds a reaction to a message takes a message and emoji

func (*Client) Reconnect

func (c *Client) Reconnect()

func (*Client) RegisterUser

func (c *Client) RegisterUser(credentials *models.UserCredentials) (*models.User, error)

RegisterUser a new user on the server. This function does not need a logged in user. The registered user gets logged in to set its username.

func (*Client) SendMessage

func (c *Client) SendMessage(message *models.Message) (*models.Message, error)

SendMessage sends message to channel takes message

func (*Client) SetChannelDescription

func (c *Client) SetChannelDescription(roomID string, description string) error

SetChannelDescription sets channels description takes roomID and description

func (*Client) SetChannelJoinCode

func (c *Client) SetChannelJoinCode(roomID string, joinCode string) error

SetChannelJoinCode sets channel join code takes roomID and joinCode

func (*Client) SetChannelReadOnly

func (c *Client) SetChannelReadOnly(roomID string, readOnly bool) error

SetChannelReadOnly sets channel as read only takes roomID and boolean

func (*Client) SetChannelTopic

func (c *Client) SetChannelTopic(roomID string, topic string) error

SetChannelTopic sets channel topic takes roomID and topic

func (*Client) SetChannelType

func (c *Client) SetChannelType(roomID string, roomType string) error

SetChannelType sets the channel type takes roomID and roomType

func (*Client) SetPresence

func (c *Client) SetPresence(status string) error

SetPresence set user presence.

func (*Client) StarMessage

func (c *Client) StarMessage(message *models.Message) error

StarMessage stars message takes a message object

func (*Client) StartTyping

func (c *Client) StartTyping(roomID string, username string) error

func (*Client) StopTyping

func (c *Client) StopTyping(roomID string, username string) error

func (*Client) Sub

func (c *Client) Sub(name string, args ...interface{}) (chan string, error)

Subscribes to stream-notify-logged Returns a buffered channel

func (*Client) SubscribeToMessageStream

func (c *Client) SubscribeToMessageStream(channel *models.Channel, msgChannel chan models.Message) error

SubscribeToMessageStream Subscribes to the message updates of a channel Returns a buffered channel

func (*Client) UnArchiveChannel

func (c *Client) UnArchiveChannel(roomID string) error

UnArchiveChannel unarchives the channel Takes roomID

func (*Client) UnPinMessage

func (c *Client) UnPinMessage(message *models.Message) error

UnPinMessage unpins message takes a message object

func (*Client) UnStarMessage

func (c *Client) UnStarMessage(message *models.Message) error

UnStarMessage unstars message takes message object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL