KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am new to using SignalR (started today), Pretty simple to send a message to ALL clients connected, but now I want to just send to a group. I cannot find simple documentation on how to join on the client side. If anyone can help, how can I SIMPLY join a group on the javascript side. Thanks for any help. public class EventHub : Hub { public void SendNewMedia(MediaInfoViewModel model,Guid eventId) { Clients.Group(eventId.ToString()).setupmedia(model); } } //Controller that is sending client new data var eventHub = GlobalHost.ConnectionManager.GetHubContext<EventHub>(); var result = eventHub.Clients.Group(eventId.ToString()).setupmedia(eventViewer); //Finally the javascript. Not sure how to setup just for a group $(function () { var event = $.connection.eventHub; event.client.setupmedia = function (newMedia) { $('#photolist').prepend('<li><img src="' + newMedia.MediaUrl + '" class="img-polaroid span2"/></li>'); }; $.connection.hub.start(function() { event.server.create(eventID);//I know this is wrong but not sure how to connect }).done(function () { alert('conntected. Ready to retrieve data!'); }); });
Tags (comma-separated)
Save Edits
Cancel