You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a debugging tool to test ASP.Net Core SignalR hubs. This is a UI based SignalR client. Using this tool, we can send the data to the SignalR hub and receive the response from the SignalR Hub. This tool is design for dotnetcore developer to make their life easier when they will work with SignalR.
5
+
It is a debugging tool to test ASP.Net Core SignalR hubs. This is a UI based SignalR client. Using this tool, we can send the data to the SignalR hub and receive a response from the SignalR Hub. This tool is designed for DotNet core developers to make their life easier when they will work with SignalR.
2. Once the cloning is completed, go to "SignalR-Web-Client" folder.
61
+
2. Once the cloning is completed, go to the "SignalR-Web-Client" folder.
57
62
```
58
63
cd SignalR-Web-Client
59
64
```
60
-
3. The **tool need to be run under some server**. This is one of the requirement of SignalR library. So, if you already have a running server, then copy the content of "SignalR-Web-Client\dist" folder and put it on your server.<br/>
61
-
If you don't have server or wants to run the tool in different server, no worry.<br/>
62
-
Will tell you two approches to run this tool.
65
+
3. The **tool needs to be run under some server**. This is one of the requirements of the SignalR library. So, if you already have a running server, then copy the content of "SignalR-Web-Client\dist" folder and put it on your server.<br/>
66
+
If you don't have a server or wants to run the tool in a different server, no worry.<br/>
67
+
Will tell you two approaches to run this tool.
63
68
1. ***Using http server(npm)*** <br/>
64
69
Here, we will install http-server and then we will host SignalR Web Client(published files) using this server.<br/>
65
70
```
@@ -81,7 +86,7 @@ To setup in local enviornment:
81
86
82
87
2. ***Using Webpack Dev Server*** <br/>
83
88
Here, we will not use the published files. Instead, we will build the tool and then run under the webpack dev server.<br/>
84
-
*NOTE*:: If you wants to customize the tool, then you can you this approch.
89
+
*NOTE*:: If you want to customize the tool, then you can you this approach.
85
90
```
86
91
npm install
87
92
npm run dev
@@ -94,11 +99,11 @@ To setup in local enviornment:
94
99
i 「wds」: Project is running at http://localhost:8080/
95
100
i 「wds」: webpack output is served from /
96
101
```
97
-
4. This step is required if SignalR Web client and Hub server hosted seperately.<br/>
98
-
ex: Hub Server is running on : http://localhost:5001 and <br/>
99
-
SignalR Web client is running on : http://localhost:6001<br/>
102
+
4. This step is required if SignalR Web client and Hub server hosted separately.<br/>
103
+
ex: Hub Server is running on http://localhost:5001 and <br/>
104
+
SignalR Web client is running on : http://localhost:8080<br/>
100
105
101
-
In such case, we have to inform the Hub Server, that allow SignalR Web Client (http://localhost:6001) origin.
106
+
In such a case, we have to inform the Hub Server, that allows SignalR Web Client (http://localhost:8080) origin.
102
107
103
108
```
104
109
Startup.cs
@@ -111,52 +116,59 @@ To setup in local enviornment:
111
116
.AllowAnyMethod()
112
117
.AllowAnyHeader()
113
118
.AllowCredentials()
114
-
.WithOrigins("http://localhost:6001");//SignalR Web Client Url
119
+
.WithOrigins("http://localhost:8080");//SignalR Web Client Url
115
120
}));
116
121
117
122
...
118
123
}
119
124
125
+
##refer this file
120
126
```
121
127
122
128
# How it works?
123
129
124
-
SignalR Web Client have two views:
130
+
SignalR Web Client has two views:
125
131
1. Basic
126
132
- Send data to Hub
127
-
- Listen the hub broadcast messages
133
+
- Listen to the hub broadcast messages
128
134
2. Advance
129
135
- Send data to Hub
130
-
- Listen the hub broadcast messages
131
-
- Support token based authentication
132
-
- Support multiple transport type (like *WebSocket, Long Pooling, Server Send Event*)
136
+
- Listen to the hub broadcast messages
137
+
- Support token-based authentication
138
+
- Support multiple transport type (like *WebSocket, Long Polling, Server Send Event*)
139
+
- Skip Negotiation, this feature only supported when the WebSockets transport is the only enabled transport. This setting can't be enabled when using the Azure SignalR Service.
1. Once click on connect button, it will make connection with server. Once the connection is established, if any data is broadcast from the Hub(ex. OneHub) to all the client then, it will be displayed in the response payload section.
152
+
1. Click on the connect button, it will try to connect with the server. Once the connection is established, if any data is broadcast from the Hub(ex. SampleHub) to all the client then, it will be displayed in the response payload section.
141
153
142
-
2. If we want to call any Hub method. For exmaple TesCall method
154
+
2. If we want to call any Hub method. For example SendMessage method
143
155
```csharp
144
-
public class OneHub : Hub
156
+
public class SampleHub : Hub
145
157
{
146
-
public async Task TestCall(string data)
158
+
public async Task SendMessage(string data)
147
159
{
148
160
var connectionId = Context.ConnectionId;
149
-
await Clients.Client(connectionId).SendAsync("ReceiveData", $"Data Received from TestCall method: {data}");
161
+
await Clients.Client(connectionId).SendAsync("ReceiveData", $"Data Received from SendMessage method: {data}");
150
162
}
151
163
}
152
164
```
153
165
In the tool, we have to pass the parameter.
154
166
155
167
#### Server Method:
156
-
TestCall
168
+
SendMessage
157
169
158
170
#### Request Payload:
159
-
It can take multiple parameters. In our example, TestCall method only taking one parameter of type string.
171
+
It can take multiple parameters. In our example, SendMessage method only takes one parameter of type string.
160
172
ex. TestCall(string data)
161
173
162
174
Argument textbox : Hello
@@ -167,18 +179,20 @@ In the tool, we have to pass the parameter.
Then click on send button. It will send all the data to the hub.
182
+
Then click on the send button. It will send all the data to the hub.
171
183
172
-
<imgsrc="./src/images/3.PNG" />
184
+
<!-- <img src="./src/images/3.PNG" /> -->
173
185
174
186
### Advance View
175
187
176
-
It has all the functionality which basic view provides, also it has additional features:
177
-
- Authentication Header -> We can you this, when Hub is protected using tokenbased authentication.
178
-
- Transport Type ([To know more about SignalR Transport](https://kevgriffin.com/signalr-transports-explained/)) -> WebSocket, Long Pooling, Server Send Event
188
+
It has all the functionality which basic view provides, also it has additional features like:
189
+
- Authentication Header -> We can you this when Hub is protected using token-based authentication.
190
+
- Transport Type ([To know more about SignalR Transport](https://kevgriffin.com/signalr-transports-explained/)) -> WebSocket, Long Polling, Server Send Event
0 commit comments