public void displaychange(Models.Fish msg) { var ty = lst.Find(t => t.socketid == Context.ConnectionId); if (ty != null) { ty.displayname = msg.displayname; Clients.All.changedisplay(ty); } }
public override Task OnConnected() { if (lst.Find(t => t.socketid == Context.ConnectionId) == null) { string vv = "aa-" + RandomString(5); var f = new Models.Fish() { displayname = vv, nickname = vv, socketid = Context.ConnectionId, fishidx = random.Next(1, 16) }; lst.Add(f); Clients.Client(f.socketid).allfishes(lst); Clients.Client(f.socketid).itsu(f); Clients.AllExcept(new string[] { f.socketid }).newfish(f); } return(base.OnConnected()); }