private void BroadcastDisconnect() { var response = new SyncResponse(SyncResponse.ResponseTypes.Disconnect); response.Data = new { Reason = "Admin stopped server." }; this.Broadcast(response.ToString()); }
private void HandleCameraSyncProposal(UserContext context, SyncCommand command) { // Client requests OTHER clients to sync to his camera // Re-send data to clients var users = command.Data.Users.ToObject <List <User> >(); //var users = (List<User>)JsonConvert.DeserializeObject<List<User>>(command.Data.Users.ToString()); var response = new SyncResponse(SyncResponse.ResponseTypes.ProposeSyncCameras); response.Data = command.Data; var responseString = response.ToString(); foreach (var user in users) { var conn = FindConnection(user); if (conn != null && conn.ClientAddress == context.ClientAddress.ToString()) { continue; // skip requesting user } if (conn != null) { conn.Context.Send(responseString); } } }
private void BroadcastUserlist() { var users = this.State.Users.ToList(); // _users.Where(u => u.IsRegistered).ToList(); var response = new SyncResponse(SyncResponse.ResponseTypes.UserList); response.Data = new { Users = users }; this.Broadcast(response.ToString()); this.OnUpdateConnections(); }
private void BroadcastState() { // Copy settings that clients require _state.OfftrackLimit = Properties.Settings.Default.OfftrackLimit; var response = new SyncResponse(SyncResponse.ResponseTypes.UpdateState); response.Data = new { State = _state }; Debug.WriteLine(">> Broadcasting state: " + response); this.Broadcast(response.ToString()); }
private void SendState(UserContext context) { // Re-send the state if connected var conn = this.FindConnection(context); if (conn != null && conn.IsRegistered) { var response = new SyncResponse(SyncResponse.ResponseTypes.UpdateState); response.Data = new { State = _state }; context.Send(response.ToString()); } }
private void BroadcastDisconnect() { var response = new SyncResponse(SyncResponse.ResponseTypes.Disconnect); response.Data = new {Reason = "Admin stopped server."}; this.Broadcast(response.ToString()); }
private void BroadcastState() { // Copy settings that clients require _state.OfftrackLimit = Properties.Settings.Default.OfftrackLimit; var response = new SyncResponse(SyncResponse.ResponseTypes.UpdateState); response.Data = new { State = _state }; Debug.WriteLine(">> Broadcasting state: " + response); this.Broadcast(response.ToString()); }
private void BroadcastUserlist() { var users = this.State.Users.ToList(); // _users.Where(u => u.IsRegistered).ToList(); var response = new SyncResponse(SyncResponse.ResponseTypes.UserList); response.Data = new { Users = users }; this.Broadcast(response.ToString()); this.OnUpdateConnections(); }
private void Reply(UserContext context, SyncResponse response) { context.Send(response.ToString()); }
private void SendState(UserContext context) { // Re-send the state if connected var conn = this.FindConnection(context); if (conn != null && conn.IsRegistered) { var response = new SyncResponse(SyncResponse.ResponseTypes.UpdateState); response.Data = new { State = _state }; context.Send(response.ToString()); } }
private void HandleCameraSyncProposal(UserContext context, SyncCommand command) { // Client requests OTHER clients to sync to his camera // Re-send data to clients var users = command.Data.Users.ToObject<List<User>>(); //var users = (List<User>)JsonConvert.DeserializeObject<List<User>>(command.Data.Users.ToString()); var response = new SyncResponse(SyncResponse.ResponseTypes.ProposeSyncCameras); response.Data = command.Data; var responseString = response.ToString(); foreach (var user in users) { var conn = FindConnection(user); if (conn != null && conn.ClientAddress == context.ClientAddress.ToString()) continue; // skip requesting user if (conn != null) { conn.Context.Send(responseString); } } }
private void Reply(UserContext context, SyncResponse response) { context.Send(response.ToString()); }