Cocos2d-x  v3.17
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
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...
 
var send ( var 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...
 
var emit ( var eventname, var 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...
 
var 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...
 
local 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...
 
local getReferenceCount ()
 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
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

A single connection to a socket.io endpoint.

Member Function Documentation

SocketIO::SIODelegate* getDelegate ( )
inline

Get the delegate for the client.

Returns
the delegate object for the client
var getDelegate ( )
inline

Get the delegate for the client.

Returns
the delegate object for the client
void send ( const std::string &  s)

Send a message to the socket.io server.

Parameters
smessage.
var send ( var  s)

Send a message to the socket.io server.

Parameters
smessage.
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
var emit ( var  eventname,
var  args 
)

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

Parameters
eventname
args
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.
var on ( var  eventName,
var  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.
void setTag ( const char *  tag)

Set tag of SIOClient.

The tag is used to distinguish the various SIOClient objects.

Parameters
tagstring object.
var setTag ( var  tag)

Set tag of SIOClient.

The tag is used to distinguish the various SIOClient objects.

Parameters
tagstring object.
const char* getTag ( )
inline

Get tag of SIOClient.

Returns
const char* the pointer point to the _tag.
var 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: