Skip to content

Instantly share code, notes, and snippets.

@davidfowl
Created September 7, 2012 23:17
Show Gist options
  • Save davidfowl/3670626 to your computer and use it in GitHub Desktop.
Save davidfowl/3670626 to your computer and use it in GitHub Desktop.
VNext SignalR API
Clients.addMessage(message);
Others.addMessage(message); // Does not exist yet
Clients[group].addMessage(message);
Clients[Context.ConnectionId].addMessage(message);
IClientProxy proxy = Clients;
proxy.Invoke("addMessage", message);
IClientProxy proxy1 = Clients[group];
proxy1.Invoke("addMessage", message);
// Dynamic
InvokeOn.All.addMessage(message);
InvokeOn.Others.addMessage(message);
InvokeOn.Caller.addMessage(message);
InvokeOn.Group(group).addMessage(message);
InvokeOn.Client(Context.ConnectionId).addMessage(message);
// Indirect
Invoke("addMessage", message).On.All();
Invoke("addMessage", message).On.Others();
Invoke("addMessage", message).On.Caller();
Invoke("addMessage", message).On.Group(group);
Invoke("addMessage", message).On.Client(Context.ConnectionId);
// Dynamic
Clients.All.addMessage(message);
Clients.Others.addMessage(message);
Clients.Caller.addMessage(message);
Clients.Group(group).addMessage(message);
Clients.Client(Context.ConnectionId).addMessage(message);
// Indirect
Clients.Invoke("addMessage", message).On.All();
Clients.Invoke("addMessage", message).On.Others();
Clients.Invoke("addMessage", message).On.Caller();
Clients.Invoke("addMessage", message).On.Group(group);
Clients.Invoke("addMessage", message).On.Client(Context.ConnectionId);
// Dynamic
Connected.All.addMessage(message);
Connected.Others.addMessage(message);
Connected.Caller.addMessage(message);
Connected.Group(group).addMessage(message);
Connected.Client(Context.ConnectionId).addMessage(message);
// Indirect
Connected.Invoke("addMessage", message).On.All();
Connected.Invoke("addMessage", message).On.Others();
Connected.Invoke("addMessage", message).On.Caller();
Connected.Invoke("addMessage", message).On.Group(group);
Connected.Invoke("addMessage", message).On.Client(Context.ConnectionId);
@Dave76
Copy link

Dave76 commented Sep 8, 2012

I'm liking V2 the best. Dude, SignalR has total changed the way I build webapps. Keep up the excellent work.

@johnnyelwailer
Copy link

I don't like the lowercase addMessage. This would break our stylecop. I don't like dynamic either, would prefer an interface to define the actions on.

@motowilliams
Copy link

Is the .On.Others(); the method that sends to everybody but the sender? SignalR/SignalR#105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment