Channels#

Enumerations#

OmniClientChannelEvent

Channel Event.

Functions#

OmniClientRequestId omniClientJoinChannel(char const *url, void *userData, OmniClientJoinChannelCallback callback)

Start listening to a channel.

OmniClientRequestId omniClientSendMessage(OmniClientRequestId joinRequestId, struct OmniClientContent *content, void *userData, OmniClientSendMessageCallback callback)

Send a message to a channel.

Typedefs#

OmniClientJoinChannelCallback

This is called with the result of omniClientJoinChannel .

OmniClientSendMessageCallback

This is called with the result of omniClientSendMessage .

Enumerations#

enum OmniClientChannelEvent#

Channel Event.

Values:

enumerator eOmniClientChannelEvent_Error#

An unknown error occurred.

enumerator eOmniClientChannelEvent_Message#

Someone sent a message.

enumerator eOmniClientChannelEvent_Hello#

You joined a channel that someone else was already in, and they said hello.

enumerator eOmniClientChannelEvent_Join#

Someone joined the channel.

enumerator eOmniClientChannelEvent_Left#

Someone left the channel (as of Nucleus 114, the server does not appear to send these)

enumerator eOmniClientChannelEvent_Deleted#

Someone deleted the channel or changed ACLs so you no longer have access.

enumerator Count_eOmniClientChannelEvent#

Functions#

OmniClientRequestId omniClientJoinChannel(
char const *url,
void *userData,
OmniClientJoinChannelCallback callback,
)#

Start listening to a channel.

This also creates the channel, if it doesn’t already exist. The callback might be called more than once. The content buffer is normally freed after the callback returns. To prevent this, “take” the content buffer by clearing it to 0 inside the callback (after copying it somewhere else, of course). You are then responsible for calling content->free(content->buffer) when you’re finished with it

Note

If this function is called after omniClientShutdown, kInvalidRequestId will be returned, and the callback will not be called.

Parameters:
  • url – The URL of the channel to join

  • userData – User data passed to the callback

  • callback – The callback function to register

Returns:

A request ID that can be used with omniClientStop

OmniClientRequestId omniClientSendMessage(
OmniClientRequestId joinRequestId,
struct OmniClientContent *content,
void *userData,
OmniClientSendMessageCallback callback,
)#

Send a message to a channel.

joinRequestId is the return value from omniClientJoinChannel Sending a message before receiving an event does nothing because nobody will hear the message. Returns 0 in that case This function takes ownership of the content it calls content->free(content->buffer) when it’s finished with it (which may be some time in the future)

Note

If this function is called after omniClientShutdown, kInvalidRequestId will be returned, and the callback will not be called.

Parameters:
  • joinRequestId – The request ID returned from omniClientJoinChannel

  • content – The message content to send (ownership is transferred)

  • userData – User data passed to the callback

  • callback – The callback function to register

Returns:

A request ID that can be used with omniClientStop

Typedefs#

typedef void (*OmniClientJoinChannelCallback)(void *userData, OmniClientResult result, OmniClientChannelEvent eventType, char const *from, struct OmniClientContent *content)#

This is called with the result of omniClientJoinChannel.

typedef void (*OmniClientSendMessageCallback)(void *userData, OmniClientResult result)#

This is called with the result of omniClientSendMessage.