Cocos2d-x  v4
SIOClient Class Reference

A single connection to a socket.io endpoint. More...

Inherits Ref.

Public Member Functions

SocketIO::SIODelegategetDelegate ()
 Get the delegate for the client. More...
 
void disconnect ()
 Disconnect from the endpoint, onClose will be called for the delegate when complete.
 
void send (const std::string &s)
 Send a message to the socket.io server. More...
 
void emit (const std::string &eventname, const std::string &args)
 Emit the eventname and the args to the endpoint that _path point to. More...
 
void on (const std::string &eventName, SIOEvent e)
 Used to register a socket.io event callback. More...
 
void setTag (const char *tag)
 Set tag of SIOClient. More...
 
const char * getTag ()
 Get tag of SIOClient. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

A single connection to a socket.io endpoint.

@lua NA

Member Function Documentation

◆ getDelegate()

SocketIO::SIODelegate* getDelegate ( )
inline

Get the delegate for the client.

Returns
the delegate object for the client

◆ send()

void send ( const std::string &  s)

Send a message to the socket.io server.

Parameters
smessage.

◆ emit()

void emit ( const std::string &  eventname,
const std::string &  args 
)

Emit the eventname and the args to the endpoint that _path point to.

Parameters
eventname
args

◆ on()

void on ( const std::string &  eventName,
SIOEvent  e 
)

Used to register a socket.io event callback.

Event argument should be passed using CC_CALLBACK2(&Base::function, this).

Parameters
eventNamethe name of event.
ethe callback function.

◆ setTag()

void setTag ( const char *  tag)

Set tag of SIOClient.

The tag is used to distinguish the various SIOClient objects.

Parameters
tagstring object.

◆ getTag()

const char* getTag ( )
inline

Get tag of SIOClient.

Returns
const char* the pointer point to the _tag.

The documentation for this class was generated from the following file: