public void StartClient() { client.Connect(networkAddress, networkPort); clientID = 0; insightNetworkConnection = new InsightNetworkConnection(); insightNetworkConnection.Initialize(this, networkAddress, clientID, connectionID); OnClientStart(); }
public bool AddConnection(InsightNetworkConnection conn) { if (!connections.ContainsKey(conn.connectionId)) { // connection cannot be null here or conn.connectionId // would throw NRE connections[conn.connectionId] = conn; conn.SetHandlers(messageHandlers); return(true); } // already a connection with this id return(false); }
void HandleConnect(Message msg) { // get ip address from connection string address = GetConnectionInfo(msg.connectionId); // add player info InsightNetworkConnection conn = new InsightNetworkConnection(); conn.Initialize(this, address, serverHostId, msg.connectionId); AddConnection(conn); OnConnected(conn); }
void HandleConnect(int connectionId) { logger.Log("[InsightServer] - Client connected connectionID: " + connectionId, this); // get ip address from connection string address = GetConnectionInfo(connectionId); // add player info InsightNetworkConnection conn = new InsightNetworkConnection(); conn.Initialize(this, address, serverHostId, connectionId); AddConnection(conn); }
public virtual void Start() { Application.runInBackground = true; clientID = 0; insightNetworkConnection = new InsightNetworkConnection(); insightNetworkConnection.Initialize(this, networkAddress, clientID, connectionID); insightNetworkConnection.SetHandlers(messageHandlers); transport.OnClientConnected = OnConnected; transport.OnClientDataReceived = HandleBytes; transport.OnClientDisconnected = OnDisconnected; transport.OnClientError = OnError; if (AutoStart) { StartInsight(); } }
public virtual void Start() { if (DontDestroy) { DontDestroyOnLoad(this); } Application.runInBackground = true; if (AutoStart) { StartInsight(); } clientID = 0; insightNetworkConnection = new InsightNetworkConnection(); insightNetworkConnection.Initialize(this, networkAddress, clientID, connectionID); insightNetworkConnection.SetHandlers(messageHandlers); transport.OnClientConnected.AddListener(OnConnected); transport.OnClientDataReceived.AddListener(HandleBytes); transport.OnClientDisconnected.AddListener(OnDisconnected); transport.OnClientError.AddListener(OnError); }
public virtual void OnDisconnected(InsightNetworkConnection conn) { Debug.Log("OnDisconnected"); }
void OnData(InsightNetworkConnection conn, byte[] data) { conn.TransportReceive(data); }
public InsightNetworkMessage(InsightNetworkConnection conn, int callbackId) { this.callbackId = callbackId; this.conn = conn; }
public InsightNetworkMessage(InsightNetworkConnection conn) { this.conn = conn; }