

using ChatJs.Admin;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof (Startup))]
namespace ChatJs.Admin
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
this.ConfigureAuth(app);
app.MapSignalR();
}
}
}
然后,在需要使用ChatJS的页面引入以下两个JS脚本:
<script src="/Scripts/jquery.signalR-2.0.3.min.js"></script> <script src="/signalr/hubs" type="text/javascript"></script>
<script src="/ChatJS/js/jquery.chatjs.min.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="/ChatJS/css/jquery.chatjs.css" />
<script type="text/javascript">
$(function() {
$.chat({
// your user information
userId: 1, // this should be dynamic
// text displayed when the other user is typing
typingText: ‘ is typing...‘,
// the title for the user‘s list window
titleText: ‘Chat‘,
// text displayed when there‘s no other users in the room
emptyRoomText: "There‘s no one around here. You can still open a session in another browser and chat with yourself :)",
// the adapter you are using
adapter: new SignalRAdapter()
});
});
</script>
基于SignalR的web端即时通讯 - ChatJS,布布扣,bubuko.com
原文:http://www.cnblogs.com/FuzhePan/p/3876104.html