Outline
1. Hub Consumers
2. jQuery Clients
3. .NET Clients
1. Hub Consumers
2. jQuery Client
First approach:
jQuery with Proxy – part I
Demo 1 – UI preparation
1. Must include both javascript files, jQuery.js & SignalR.js BEFORE 2. SignalR/Hubs
2. Must include SignalR/Hubs
3. Include personal javascript file
Demo 2 – SignalR Utilities (signalr.exe) to generate server.js file
jQuery with Proxy – part II
jQuery with Proxy – part III
Demo 3 – Chat.js
Explain above 3 points:
1. chat.client.newMessage –> newMessage() is a client event method that can be called from server side. Define client behavior first
2. Once button click, trigger server side event by this line of code chat.server.sendMessage(xxx), so all clients will run client side event newMessage() which defined in previous step
3. Enforce to use longPolling as transport negociation protocal and start hub connection
Demo – Join Group
Demo – Monitor (test fail)
Second approach:
jQuery without Proxy File
Demo
3. .NET Client
Demo – Win Form
沒有留言:
張貼留言