Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
SIOClient Class Reference

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

Inherits Ref.

Public Member Functions

 SIOClient (const std::string &host, int port, const std::string &path, SIOClientImpl *impl, SocketIO::SIODelegate &delegate)
 Construtor of SIOClient class. More...
 
 SIOClient ( var host, var port, var path, var impl, var delegate)
 Construtor of SIOClient class. More...
 
virtual ~SIOClient ()
 Destructior of SIOClient class.
 
SocketIO::SIODelegategetDelegate ()
 Get the delegate for the client the delegate object for the client.
 
var getDelegate ()
 Get the delegate for the client the delegate object for the client.
 
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...
 
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...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local 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...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

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.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

A single connection to a socket.io endpoint.

Constructor & Destructor Documentation

SIOClient ( const std::string &  host,
int  port,
const std::string &  path,
SIOClientImpl *  impl,
SocketIO::SIODelegate delegate 
)

Construtor of SIOClient class.

the string that represent the host address. the int value represent the port number. the string that represent endpoint. the SIOClientImpl object. the SIODelegate object.

var SIOClient ( var  host,
var  port,
var  path,
var  impl,
var  delegate 
)

Construtor of SIOClient class.

the string that represent the host address. the int value represent the port number. the string that represent endpoint. the SIOClientImpl object. the SIODelegate object.

Member Function Documentation

void send ( const std::string &  s)

Send a message to the socket.io server.

message.

var send ( var  s)

Send a message to the socket.io server.

message.

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

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

the name of event. the argument of event.

var emit ( var  eventname,
var  args 
)

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

the name of event. the argument of event.

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).

the name of event. the 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).

the name of event. the callback function.

void setTag ( const char *  tag)

Set tag of SIOClient.

The tag is used to distinguish the various SIOClient objects. string object.

var setTag ( var  tag)

Set tag of SIOClient.

The tag is used to distinguish the various SIOClient objects. string object.

const char* getTag ( )
inline

Get tag of SIOClient.

the pointer point to the _tag.

var getTag ( )
inline

Get tag of SIOClient.

the pointer point to the _tag.


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