void LobbyController_OnOpen(object sender, OnClientConnectArgs e) { #if DEBUG Debug.WriteLine(e.Controller.ClientGuid); #endif this.GameId = e.Controller.GetParameter("gameId"); }
/// <summary> /// When a client connects create a new PeerConnection and send the information the the client /// </summary> /// <param name="sender"></param> /// <param name="onClientConnectArgs"></param> private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs) { IPresence user = new Presence {Online = true, UserName = "******", Id = this.PersistentId}; //Update user if (Core.Utility.Storage.Repository<Guid, IPresence>.ContainsKey(this.PersistentId)) { user = Core.Utility.Storage.Repository<Guid, IPresence>.GetById(user.Id); if (this.HasParameterKey("username")) user.UserName = this.GetParameter("username"); } SavePresence(user); var others = Core.Utility.Storage.Repository<Guid, IPresence>.Find(p => p.Id != user.Id); Composable.GetExport<IXLogger>().Information("Others {@a}",others); this.Invoke(others,"allusers"); // Get the context from a parameter if it exists var context = Guid.NewGuid(); if (this.HasParameterKey("ctx")) { var p = this.GetParameter("ctx"); context = Guid.Parse(p); } Peer = new PeerConnection { Context = context, PeerId = ConnectionId }; this.Invoke(Peer, Events.Context.Created); }
void Client_OnOpen(object sender, OnClientConnectArgs e) { SelectedTypes = Notification.AllTypes; // Send all available notification types to the client when s/he connects. No need to ask for them. this.Send(SelectedTypes, "allTypes"); }
void wss_OnServerClientConnection(object sender, OnClientConnectArgs e) { Debug.WriteLine(""); Debug.WriteLine("Connected"); Debug.WriteLine("Handler: "+ ((IXBaseSocket)sender).Alias); Debug.WriteLine("ClientGuid: "+ e.XNode.ClientGuid); Debug.WriteLine(""); }
/// <summary> /// When a client connects create a new PeerConnection and send the information the the client /// </summary> /// <param name="sender"></param> /// <param name="onClientConnectArgs"></param> private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs) { Peer = new PeerConnection { Context = this.ProtocolInstance.Parameters.ContainsKey("ctx") ? Guid.Parse(this.ProtocolInstance.Parameters["ctx"]) : Guid.NewGuid(), PeerId = ClientGuid }; }
/// <summary> /// When a client connects create a new PeerConnection and send the information the the client /// </summary> /// <param name="sender"></param> /// <param name="onClientConnectArgs"></param> private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs) { Peer = new PeerConnection { Context = Guid.NewGuid(), PeerId = ClientGuid }; }
void wss_OnServerClientConnection(object sender, OnClientConnectArgs e) { Debug.WriteLine(""); Debug.WriteLine("Connected"); Debug.WriteLine("Handler: " + ((IXBaseSocket)sender).Alias); Debug.WriteLine("ClientGuid: " + e.XNode.ClientGuid); Debug.WriteLine(""); }
/// <summary> /// When a client connects create a new PeerConnection and send the information the the client /// </summary> /// <param name="sender"></param> /// <param name="onClientConnectArgs"></param> private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs) { Peer = new PeerConnection { Context = Guid.NewGuid(), PeerId = ConnectionId }; }
/// <summary> /// When a client connects create a new PeerConnection and send the information the the client /// </summary> /// <param name="sender"></param> /// <param name="onClientConnectArgs"></param> private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs) { IPresence user = new Presence { Online = true, UserName = "******", Id = this.PersistentId }; //Update user if (Core.Utility.Storage.Repository <Guid, IPresence> .ContainsKey(this.PersistentId)) { user = Core.Utility.Storage.Repository <Guid, IPresence> .GetById(user.Id); if (this.HasParameterKey("username")) { user.UserName = this.GetParameter("username"); } } SavePresence(user); var others = Core.Utility.Storage.Repository <Guid, IPresence> .Find(p => p.Id != user.Id); Composable.GetExport <IXLogger>().Information("Others {@a}", others); this.Invoke(others, "allusers"); // Get the context from a parameter if it exists var context = Guid.NewGuid(); if (this.HasParameterKey("ctx")) { var p = this.GetParameter("ctx"); context = Guid.Parse(p); } Peer = new PeerConnection { Context = context, PeerId = ConnectionId }; this.Invoke(Peer, Events.Context.Created); }
void wss_OnServerClientConnection(object sender, OnClientConnectArgs e) { try { Debug.WriteLine(""); Debug.WriteLine("Connected"); Debug.WriteLine("Handler: " + ((IXBaseSocket)sender).Alias); Debug.WriteLine("ClientGuid: " + e.Client.ClientGuid); Debug.WriteLine(""); } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } }
void SampleController_OnOpen(object sender, OnClientConnectArgs e) { //Send connected topic to client that connected. //Just passing a anonymous object with info about the client, but it can be anything serializable.. this.Send(new { this.ClientGuid, this.StorageGuid }, "connected"); }
void SampleController_OnOpen(object sender, OnClientConnectArgs e) { //Send connected topic to client that connected. //Just passing a anonymous object with info about the client, but it can be anything serializable.. this.Invoke(new { this.ConnectionId, this.Context.PersistentId }, "connected"); }
private void OnClientConnect(object sender, OnClientConnectArgs e) { //stop the timer if the client ACK this.ProtocolInstance.OnPing += (s, args) => mAckTimer.Stop();//protocol instance is null until someone connects }
private void OnOnReopen(object sender, OnClientConnectArgs onClientConnectArgs) { }
/// <summary> /// When a client connects create a new PeerConnection and send the information the the client /// </summary> /// <param name="sender"></param> /// <param name="onClientConnectArgs"></param> private void _OnOpen(object sender, OnClientConnectArgs onClientConnectArgs) { // Get the context from a parameter if it exists var context = Guid.NewGuid(); if (this.HasParameterKey("ctx")) { var p = this.GetParameter("ctx"); context = Guid.Parse(p); } Peer = new PeerConnection { Context = context, PeerId = ConnectionId }; this.Invoke(Peer, Events.Context.Created); }
void StockController_OnOpen(object sender, OnClientConnectArgs e) { //Send to available stocks to the client when he/she´s connected. No need to ask for them. this.Invoke(Model.StockTicker.Stocks.Values, "allStocks"); }