cocos2d-x  3.5
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SIOClient Class Reference

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

#include <SocketIO.h>

Inheritance diagram for SIOClient:
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...
 
virtual ~SIOClient (void)
 Destructior of SIOClient class. More...
 
SocketIO::SIODelegategetDelegate ()
 Get the delegate for the client. More...
 
void disconnect ()
 Disconnect from the endpoint, onClose will be called for the delegate when complete. More...
 
void send (std::string s)
 Send a message to the socket.io server. More...
 
void emit (std::string eventname, 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...
 

Friends

class SIOClientImpl

Additional Inherited Members

- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references 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.

Parameters
hostthe string that represent the host address.
portthe int value represent the port number.
paththe string that represent endpoint.
implthe SIOClientImpl object.
delegatethe SIODelegate object.
virtual ~SIOClient ( void  )
virtual

Destructior of SIOClient class.

Member Function Documentation

void disconnect ( )

Disconnect from the endpoint, onClose will be called for the delegate when complete.

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

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

Parameters
eventname
args
SocketIO::SIODelegate* getDelegate ( )
inline

Get the delegate for the client.

Returns
the delegate object for the client
const char* getTag ( )
inline

Get tag of SIOClient.

Returns
const char* the pointer point to the _tag.
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
eventName.
ethe callback function.
void send ( std::string  s)

Send a message to the socket.io server.

Parameters
smessage.
void setTag ( const char *  tag)
inline

Set tag of SIOClient.

The tag is used to distinguish the various SIOClient objects.

Parameters
tagstring object.

Friends And Related Function Documentation

friend class SIOClientImpl
friend

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