Cocos2d-x  v3.17
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
SocketIO::SIODelegate Class Referenceabstract

The delegate class to process socket.io events. More...

Public Member Functions

virtual ~SIODelegate ()
 Destructor of SIODelegate. More...
 
virtual void onConnect (SIOClient *client)
 This is kept for backwards compatibility, connect is now fired as a socket.io event "connect". More...
 
virtual void onMessage (SIOClient *client, const std::string &data)
 This is kept for backwards compatibility, message is now fired as a socket.io event "message". More...
 
var onMessage ( var client, var data)
 This is kept for backwards compatibility, message is now fired as a socket.io event "message". More...
 
virtual void onClose (SIOClient *client)=0
 Pure virtual callback function, this function should be overridden by the subclass. More...
 
var onClose ( var client)
 Pure virtual callback function, this function should be overridden by the subclass. More...
 
virtual void onError (SIOClient *client, const std::string &data)=0
 Pure virtual callback function, this function should be overridden by the subclass. More...
 
var onError ( var client, var data)
 Pure virtual callback function, this function should be overridden by the subclass. More...
 
virtual void fireEventToScript (SIOClient *client, const std::string &eventName, const std::string &data)
 Fire event to script when the related SIOClient object receive the fire event signal. More...
 

Detailed Description

The delegate class to process socket.io events.

Constructor & Destructor Documentation

virtual ~SIODelegate ( )
inlinevirtual

Destructor of SIODelegate.

var ~SIODelegate ( )
inlinevirtual

Destructor of SIODelegate.

Member Function Documentation

virtual void onConnect ( SIOClient client)
inlinevirtual

This is kept for backwards compatibility, connect is now fired as a socket.io event "connect".

This function would be called when the related SIOClient object receive messages that mean it have connected to endpoint successfully.

Parameters
clientthe connected SIOClient object.
var onConnect ( var  client)
inlinevirtual

This is kept for backwards compatibility, connect is now fired as a socket.io event "connect".

This function would be called when the related SIOClient object receive messages that mean it have connected to endpoint successfully.

Parameters
clientthe connected SIOClient object.
virtual void onMessage ( SIOClient client,
const std::string &  data 
)
inlinevirtual

This is kept for backwards compatibility, message is now fired as a socket.io event "message".

This function would be called when the related SIOClient object receive message or json message.

Parameters
clientthe connected SIOClient object.
datathe message,it could be json message
var onMessage ( var  client,
var  data 
)
inlinevirtual

This is kept for backwards compatibility, message is now fired as a socket.io event "message".

This function would be called when the related SIOClient object receive message or json message.

Parameters
clientthe connected SIOClient object.
datathe message,it could be json message
virtual void onClose ( SIOClient client)
pure virtual

Pure virtual callback function, this function should be overridden by the subclass.

This function would be called when the related SIOClient object disconnect or receive disconnect signal.

Parameters
clientthe connected SIOClient object.
var onClose ( var  client)
pure virtual

Pure virtual callback function, this function should be overridden by the subclass.

This function would be called when the related SIOClient object disconnect or receive disconnect signal.

Parameters
clientthe connected SIOClient object.
virtual void onError ( SIOClient client,
const std::string &  data 
)
pure virtual

Pure virtual callback function, this function should be overridden by the subclass.

This function would be called when the related SIOClient object receive error signal or didn't connect the endpoint but do some network operation, eg.,send and emit,etc.

Parameters
clientthe connected SIOClient object.
datathe error message
var onError ( var  client,
var  data 
)
pure virtual

Pure virtual callback function, this function should be overridden by the subclass.

This function would be called when the related SIOClient object receive error signal or didn't connect the endpoint but do some network operation, eg.,send and emit,etc.

Parameters
clientthe connected SIOClient object.
datathe error message
virtual void fireEventToScript ( SIOClient client,
const std::string &  eventName,
const std::string &  data 
)
inlinevirtual

Fire event to script when the related SIOClient object receive the fire event signal.

Parameters
clientthe connected SIOClient object.
eventNamethe event's name.
datathe event's data information.
var fireEventToScript ( var  client,
var  eventName,
var  data 
)
inlinevirtual

Fire event to script when the related SIOClient object receive the fire event signal.

Parameters
clientthe connected SIOClient object.
eventNamethe event's name.
datathe event's data information.

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