private void OnAddSubscriber(MasterClientPeer subscriber) { this.subscribers.Add(subscriber); EventData eventData = this.GetAppStatsEventData(); subscriber.SendEvent(eventData, new SendParameters { Unreliable = true }); }
public virtual void OnClientConnected(MasterClientPeer peer) { if (log.IsDebugEnabled) { log.DebugFormat("OnClientConnect: peerId={0}, appId={1}", peer.ConnectionId, this.ApplicationId); } // remove from player cache if (this.PlayerOnlineCache != null && string.IsNullOrEmpty(peer.UserId) == false) { this.PlayerOnlineCache.OnConnectedToMaster(peer.UserId); } }
public virtual void OnClientDisconnected(MasterClientPeer peer) { if (log.IsDebugEnabled) { log.DebugFormat("OnClientDisconnect: peerId={0}, appId={1}", peer.ConnectionId, this.ApplicationId); } // remove from player cache if (this.PlayerOnlineCache != null && string.IsNullOrEmpty(peer.UserId) == false) { this.PlayerOnlineCache.OnDisconnectFromMaster(peer.UserId); } }
public virtual void OnClientDisconnected(MasterClientPeer peer) { if (log.IsDebugEnabled) { log.DebugFormat("OnClientDisconnect: peerId={0}, appId={1}", peer.ConnectionId, this.ApplicationId); } // remove from player cache if (this.PlayerOnlineCache != null && string.IsNullOrEmpty(peer.UserId) == false) { this.PlayerOnlineCache.OnDisconnectFromMaster(peer.UserId); } // unsubscribe from lobby statistic events this.LobbyStatsPublisher.Unsubscribe(peer); }
protected override PeerBase CreatePeer(InitRequest initRequest) { if (this.IsGameServerPeer(initRequest)) { if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game server"); } return(new IncomingGameServerPeer(initRequest, this)); } if (this.LocalNodeId == this.MasterNodeId) { if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game client on leader node"); } var peer = new MasterClientPeer(initRequest); var settings = WebRpcSettings.Default; if (settings != null && settings.Enabled) { peer.WebRpcHandler = new WebRpcHandler( settings.BaseUrl.Value, new Dictionary <string, object> { { "AppId", this.HwId }, { "AppVersion", "" }, { "Region", "" }, { "Cloud", "" }, }, null, new HttpRequestQueueOptions(httpQueueReconnectInterval: settings.ReconnectInterval * 1000)); } return(peer); } if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game client on slave node"); } return(new RedirectedClientPeer(initRequest)); }
protected override PeerBase CreatePeer(InitRequest initRequest) { if (this.IsGameServerPeer(initRequest)) { if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game server"); } return(this.CreateGameServerPeer(initRequest)); } log.Info("一个客户端连接中......MasterAppliction11"); if (this.LocalNodeId == this.MasterNodeId) { log.Info("一个客户端连接中......MasterAppliction111"); if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game client on leader node"); } var peer = new MasterClientPeer(initRequest); peerList.Add(peer); for (var i = 0; peerList.Count > i; i++) { log.Info("====展示信息===:" + peerList[i].ToString()); } log.Info("====客户端:========:" + peerList.ToString()); if (this.webRpcManager.IsRpcEnabled) { peer.WebRpcHandler = this.webRpcManager.GetWebRpcHandler(); } return(peer); } if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game client on slave node"); } log.Info("一个客户端连接中......MasterAppliction11111"); return(new RedirectedClientPeer(initRequest)); }
public void RemoveSubscriber(MasterClientPeer peer) { this.fiber.Enqueue(() => this.OnRemoveSubscriber(peer)); }
private void OnRemoveSubscriber(MasterClientPeer subscriber) { this.subscribers.Remove(subscriber); }
protected override PeerBase CreatePeer(InitRequest initRequest) { if (this.IsGameServerPeer(initRequest)) { if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game server"); } return new IncomingGameServerPeer(initRequest, this); } if (this.LocalNodeId == this.MasterNodeId) { if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game client on leader node"); } var peer = new MasterClientPeer(initRequest); var settings = WebRpcSettings.Default; if (settings != null && settings.Enabled) { peer.WebRpcHandler = new WebRpcHandler( settings.BaseUrl.Value, new Dictionary<string, object> { {"AppId", this.HwId}, {"AppVersion", ""}, {"Region", ""}, {"Cloud", ""}, }, null, new HttpRequestQueueOptions(httpQueueReconnectInterval: settings.ReconnectInterval * 1000)); } return peer; } if (log.IsDebugEnabled) { log.DebugFormat("Received init request from game client on slave node"); } return new RedirectedClientPeer(initRequest); }