Redis + SignalR

4,427 views
4,205 views

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,427
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Redis + SignalR

  1. 1. Redis + SignalR
  2. 2. About “shibayan”• しばやん (芝村 達郎)• @shibayan• ASP.NET/IIS MVP• http://shiba-yan.hatenablog.jp/
  3. 3. SignalR
  4. 4. SignalR + ASP.NET [HubName("chat")] public class ChatHub : Hub { public void SendMessage(string text) { Clients.ReceiveMessage(text); } } Endpoint: http://*****.cloudapp.net/signalr
  5. 5. SignalR + JavaScript var connection = $.hubConnection(); var chat = connection.createProxy("chat"); chat.on("ReceiveMessage", function(message) { $("#message").append("<li>" + message + "</li>"); }); connection.start(); $("#send").click(function () { var text = $("#text").text(); chat.invoke("SendMessage", text); });
  6. 6. SignalR + C#var connection = new HubConnection("http://localhost:12345/");var chat = connection.CreateProxy("chat");chat.On<string>("ReceiveMessage", message => MessageBox.Show(message));await connection.Start();// Button Clickedchat.Invoke("SendMessage", "text message");
  7. 7. SignalR + Scaling Pub/Sub MessagingInstance 0 Instance 1
  8. 8. Service Bus vs Redis• Price • Price • ¥0.88/10000 messages • ¥7.00/hour (Small, Preview)• Scalable • Scalable • Increase Topic Count • Increase VM Instance
  9. 9. Windows Azure VM
  10. 10. Azure VM + Redis> sudo yum install gcc> wget http://redis.googlecode.com/files/redis-2.4.17.tar.gz> tar xzf redis-2.4.17.tar.gz> cd redis-2.4.17> make> sudo make install> cd utils/> sudo ./install_server.sh
  11. 11. SignalR + Redisprotected void Application_Start(object sender, EventArgs e){ GlobalHost.DependencyResolver.UseRedis( "***.cloudapp.net", 6379, "", "SignalR.Redis.Sample" );}

×