Created
September 7, 2012 23:17
-
-
Save davidfowl/3670626 to your computer and use it in GitHub Desktop.
VNext SignalR API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
I have been working on porting socket.io protocol to .net at https://github.com/prabirshrestha/socket-io-net
here is how my api looks. https://gist.github.com/3384062
@prabirshrestha how is that relevant.
I'm liking V2 the best. Dude, SignalR has total changed the way I build webapps. Keep up the excellent work.
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.
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
v2 is good, but lose the .On.* and just make it .OnAll(), .OnOthers(), etc.