private List <Action <JsonObject> > m_cOnDisconnect; //on the disconnect /// <summary> /// Init this instance. /// </summary> internal static TranspotUpdate Init() { GameObject obj = new GameObject("Socket"); TranspotUpdate trans = obj.AddComponent <TranspotUpdate>(); return(trans); }
public void start(TranspotUpdate Updater) { this.m_cUpdater = Updater; this.m_cUpdater.SetUpdate(Update); this.m_cUpdater._Start(); this.receive(); }
// The bulk of the clean-up code protected virtual void Dispose(bool disposing) { if (this.disposed) { return; } if (disposing) { #if LUZEXI this.m_cUpdater._Destory(); this.m_cUpdater = null; // free managed resources this.protocol.close(); this.socket.Shutdown(SocketShutdown.Both); this.socket.Close(); this.disposed = true; #else // free managed resources this.protocol.close(); this.socket.Shutdown(SocketShutdown.Both); this.socket.Close(); this.disposed = true; //Call disconnect callback eventManager.InvokeOnEvent(EVENT_DISCONNECT, null); #endif } }
public bool connect(JsonObject user, Action <JsonObject> handshakeCallback) { try{ #if LUZEXI this.m_cUpdater = TranspotUpdate.Init(); protocol.start(user, handshakeCallback, this.m_cUpdater); #else protocol.start(user, handshakeCallback); #endif return(true); }catch (Exception e) { Console.WriteLine(e.ToString()); return(false); } }
internal void start(JsonObject user, Action <JsonObject> callback, TranspotUpdate updater) { this.transporter.start(updater);