I am using SignalR based on examples from https://github.com/SignalR/Samples. I am new to this but got it to work in my web app for chat room type of concept. But now I am trying to get a user to user chat functionality done using this. How can I do so?
Do I have to setup a separate connection for each of the chat sessions? Meaning user1 on browser1 is chatting with 5 people separately in single page. Do I need to have separate 5 SignalR connection from user1 to the server?
Meaning do I have to render this section next to each of my chat elements for those 5 different end points for user1? or can I just have one SignalR connection? if I only have one how to I update the correct chat controls from the server to display the response from end users?
@section scripts {
<script src="@Url.Content("~/Scripts/jquery.signalR-1.0.0-rc1.min.js")" type="text/javascript"></script>
<script src="/signalR/hubs" type="text/javascript"></script>
<script>
$(function () {
var chat = $.connection.chat;
chat.client.send = function (message) {
$('#message').append('<li>' + message + '</li>');
};
$.connection.hub.start().done(function () {
$('#send').click(function () {
chat.server.send($('#msg').val());
});
});
});
</script>
}
Is there a example somewhere I can use?