Skip to content

Commit f799f99

Browse files
authored
update
1 parent 423e0cf commit f799f99

File tree

3 files changed

+37
-36
lines changed

3 files changed

+37
-36
lines changed

articles/azure-functions/functions-bindings-signalr-service-input.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The following example shows a [C# function](functions-dotnet-class-library.md) t
3838
[FunctionName("negotiate")]
3939
public static SignalRConnectionInfo Negotiate(
4040
[HttpTrigger(AuthorizationLevel.Anonymous)]HttpRequest req,
41-
[SignalRConnectionInfo(HubName = "chat")]SignalRConnectionInfo connectionInfo)
41+
[SignalRConnectionInfo(HubName = "hubName1")]SignalRConnectionInfo connectionInfo)
4242
{
4343
return connectionInfo;
4444
}
@@ -64,7 +64,7 @@ const { app, input } = require('@azure/functions');
6464
const inputSignalR = input.generic({
6565
type: 'signalRConnectionInfo',
6666
name: 'connectionInfo',
67-
hubName: 'hub',
67+
hubName: 'hubName1',
6868
connectionStringSetting: 'AzureSignalRConnectionString',
6969
});
7070

@@ -125,7 +125,7 @@ public SignalRConnectionInfo negotiate(
125125
authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> req,
126126
@SignalRConnectionInfoInput(
127127
name = "connectionInfo",
128-
hubName = "chat") SignalRConnectionInfo connectionInfo) {
128+
HubName = "hubName1") SignalRConnectionInfo connectionInfo) {
129129
return connectionInfo;
130130
}
131131
```
@@ -164,7 +164,7 @@ public static string Negotiate([HttpTrigger(AuthorizationLevel.Anonymous)] HttpR
164164
public static SignalRConnectionInfo Negotiate(
165165
[HttpTrigger(AuthorizationLevel.Anonymous)]HttpRequest req,
166166
[SignalRConnectionInfo
167-
(HubName = "chat", UserId = "{headers.x-ms-client-principal-id}")]
167+
(HubName = "hubName1", UserId = "{headers.x-ms-client-principal-id}")]
168168
SignalRConnectionInfo connectionInfo)
169169
{
170170
// connectionInfo contains an access key token with a name identifier claim set to the authenticated user
@@ -199,7 +199,7 @@ Here's binding data in the *function.json* file:
199199
{
200200
"type": "signalRConnectionInfo",
201201
"name": "connectionInfo",
202-
"hubName": "chat",
202+
"hubName": "hubName1",
203203
"userId": "{headers.x-ms-client-principal-id}",
204204
"connectionStringSetting": "<name of setting containing SignalR Service connection string>",
205205
"direction": "in"
@@ -217,7 +217,7 @@ const { app, input } = require('@azure/functions');
217217
const inputSignalR = input.generic({
218218
type: 'signalRConnectionInfo',
219219
name: 'connectionInfo',
220-
hubName: 'hub',
220+
hubName: 'hubName1',
221221
connectionStringSetting: 'AzureSignalRConnectionString',
222222
userId: '{headers.x-ms-client-principal-id}',
223223
});
@@ -240,7 +240,7 @@ Here's binding data in the *function.json* file:
240240
{
241241
"type": "signalRConnectionInfo",
242242
"name": "connectionInfo",
243-
"hubName": "chat",
243+
"hubName": "hubName1",
244244
"userId": "{headers.x-ms-client-principal-id}",
245245
"connectionStringSetting": "<name of setting containing SignalR Service connection string>",
246246
"direction": "in"
@@ -288,7 +288,7 @@ public SignalRConnectionInfo negotiate(
288288
authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> req,
289289
@SignalRConnectionInfoInput(
290290
name = "connectionInfo",
291-
hubName = "chat",
291+
HubName = "hubName1",
292292
userId = "{headers.x-ms-client-principal-id}") SignalRConnectionInfo connectionInfo) {
293293
return connectionInfo;
294294
}

articles/azure-functions/functions-bindings-signalr-service-output.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ zone_pivot_groups: programming-languages-set-functions-lang-workers
1616
Use the *SignalR* output binding to send one or more messages using Azure SignalR Service. You can broadcast a message to:
1717

1818
- All connected clients
19+
- Connected clients in a specified group
1920
- Connected clients authenticated to a specific user
2021

21-
The output binding also allows you to manage groups.
22+
The output binding also allows you to manage groups, such as adding a client or user to a group, removing a client or user from a group.
2223

2324
For information on setup and configuration details, see the [overview](functions-bindings-signalr-service.md).
2425

@@ -44,9 +45,9 @@ The following example shows a function that sends a message using the output bin
4445
[FunctionName("SendMessage")]
4546
public static Task SendMessage(
4647
[HttpTrigger(AuthorizationLevel.Anonymous, "post")]object message,
47-
[SignalR(HubName = "chat")]IAsyncCollector<SignalRMessage> signalRMessages)
48+
[SignalR(HubName = "hubName1")]IAsyncCollector<SignalRMessage> signalROutput)
4849
{
49-
return signalRMessages.AddAsync(
50+
return signalROutput.AddAsync(
5051
new SignalRMessage
5152
{
5253
Target = "newMessage",
@@ -99,7 +100,7 @@ Here's the JavaScript code:
99100

100101
```javascript
101102
module.exports = async function (context, req) {
102-
context.bindings.signalRMessages = [{
103+
context.bindings.signalROutput = [{
103104
"target": "newMessage",
104105
"arguments": [ req.body ]
105106
}];
@@ -116,9 +117,9 @@ Complete PowerShell examples are pending.
116117
Here's the Python code:
117118

118119
```python
119-
def main(req: func.HttpRequest, outMessage: func.Out[str]) -> func.HttpResponse:
120+
def main(req: func.HttpRequest, signalROutput: func.Out[str]) -> func.HttpResponse:
120121
message = req.get_json()
121-
outMessage.set(json.dumps({
122+
signalROutput.set(json.dumps({
122123
'target': 'newMessage',
123124
'arguments': [ message ]
124125
}))
@@ -129,7 +130,7 @@ def main(req: func.HttpRequest, outMessage: func.Out[str]) -> func.HttpResponse:
129130

130131
```java
131132
@FunctionName("sendMessage")
132-
@SignalROutput(name = "$return", hubName = "chat")
133+
@SignalROutput(name = "$return", HubName = "hubName1")
133134
public SignalRMessage sendMessage(
134135
@HttpTrigger(
135136
name = "req",
@@ -161,9 +162,9 @@ You can send a message only to connections that have been authenticated to a use
161162
[FunctionName("SendMessage")]
162163
public static Task SendMessage(
163164
[HttpTrigger(AuthorizationLevel.Anonymous, "post")]object message,
164-
[SignalR(HubName = "chat")]IAsyncCollector<SignalRMessage> signalRMessages)
165+
[SignalR(HubName = "hubName1")]IAsyncCollector<SignalRMessage> signalROutput)
165166
{
166-
return signalRMessages.AddAsync(
167+
return signalROutput.AddAsync(
167168
new SignalRMessage
168169
{
169170
// the message will only be sent to this user ID
@@ -192,9 +193,9 @@ Complete PowerShell examples are pending.
192193
Here's the Python code:
193194

194195
```python
195-
def main(req: func.HttpRequest, outMessages: func.Out[str]) -> func.HttpResponse:
196+
def main(req: func.HttpRequest, signalROutput: func.Out[str]) -> func.HttpResponse:
196197
message = req.get_json()
197-
outMessage.set(json.dumps({
198+
signalROutput.set(json.dumps({
198199
#message will only be sent to this user ID
199200
'userId': 'userId1',
200201
'target': 'newMessage',
@@ -207,7 +208,7 @@ def main(req: func.HttpRequest, outMessages: func.Out[str]) -> func.HttpResponse
207208

208209
```java
209210
@FunctionName("sendMessage")
210-
@SignalROutput(name = "$return", hubName = "chat")
211+
@SignalROutput(name = "$return", HubName = "hubName1")
211212
public SignalRMessage sendMessage(
212213
@HttpTrigger(
213214
name = "req",
@@ -260,7 +261,7 @@ Here's the JavaScript code:
260261

261262
```javascript
262263
module.exports = async function (context, req) {
263-
context.bindings.signalRMessages = [{
264+
context.bindings.signalROutput = [{
264265
"target": "newMessage",
265266
"arguments": [ req.body ],
266267
"userId": "userId1",
@@ -286,9 +287,9 @@ You can send a message only to connections that have been added to a group by se
286287
[FunctionName("SendMessage")]
287288
public static Task SendMessage(
288289
[HttpTrigger(AuthorizationLevel.Anonymous, "post")]object message,
289-
[SignalR(HubName = "chat")]IAsyncCollector<SignalRMessage> signalRMessages)
290+
[SignalR(HubName = "hubName1")]IAsyncCollector<SignalRMessage> signalROutput)
290291
{
291-
return signalRMessages.AddAsync(
292+
return signalROutput.AddAsync(
292293
new SignalRMessage
293294
{
294295
// the message will be sent to the group with this name
@@ -342,7 +343,7 @@ Here's the JavaScript code:
342343

343344
```javascript
344345
module.exports = async function (context, req) {
345-
context.bindings.signalRMessages = [{
346+
context.bindings.signalROutput = [{
346347
"target": "newMessage",
347348
"arguments": [ req.body ],
348349
"groupName": "myGroup",
@@ -360,9 +361,9 @@ Complete PowerShell examples are pending.
360361
Here's the Python code:
361362

362363
```python
363-
def main(req: func.HttpRequest, outMessage: func.Out[str]) -> func.HttpResponse:
364+
def main(req: func.HttpRequest, signalROutput: func.Out[str]) -> func.HttpResponse:
364365
message = req.get_json()
365-
outMessage.set(json.dumps({
366+
signalROutput.set(json.dumps({
366367
#message will only be sent to this group
367368
'groupName': 'myGroup',
368369
'target': 'newMessage',
@@ -376,7 +377,7 @@ def main(req: func.HttpRequest, outMessage: func.Out[str]) -> func.HttpResponse:
376377

377378
```java
378379
@FunctionName("sendMessage")
379-
@SignalROutput(name = "$return", hubName = "chat")
380+
@SignalROutput(name = "$return", HubName = "hubName1")
380381
public SignalRMessage sendMessage(
381382
@HttpTrigger(
382383
name = "req",
@@ -414,7 +415,7 @@ Specify `GroupAction` to add or remove a member. The following example adds a us
414415
public static Task AddToGroup(
415416
[HttpTrigger(AuthorizationLevel.Anonymous, "post")]HttpRequest req,
416417
ClaimsPrincipal claimsPrincipal,
417-
[SignalR(HubName = "chat")]
418+
[SignalR(HubName = "hubName1")]
418419
IAsyncCollector<SignalRGroupAction> signalRGroupActions)
419420
{
420421
var userIdClaim = claimsPrincipal.FindFirst(ClaimTypes.NameIdentifier);
@@ -523,8 +524,8 @@ Complete PowerShell examples are pending.
523524
The following example adds a user to a group.
524525

525526
```python
526-
def main(req: func.HttpRequest, action: func.Out[str]) -> func.HttpResponse:
527-
action.set(json.dumps({
527+
def main(req: func.HttpRequest, signalROutput: func.Out[str]) -> func.HttpResponse:
528+
signalROutput.set(json.dumps({
528529
'userId': 'userId1',
529530
'groupName': 'myGroup',
530531
'action': 'add'
@@ -534,8 +535,8 @@ def main(req: func.HttpRequest, action: func.Out[str]) -> func.HttpResponse:
534535
The following example removes a user from a group.
535536

536537
```python
537-
def main(req: func.HttpRequest, action: func.Out[str]) -> func.HttpResponse:
538-
action.set(json.dumps({
538+
def main(req: func.HttpRequest, signalROutput: func.Out[str]) -> func.HttpResponse:
539+
signalROutput.set(json.dumps({
539540
'userId': 'userId1',
540541
'groupName': 'myGroup',
541542
'action': 'remove'
@@ -549,7 +550,7 @@ The following example adds a user to a group.
549550

550551
```java
551552
@FunctionName("addToGroup")
552-
@SignalROutput(name = "$return", hubName = "chat")
553+
@SignalROutput(name = "$return", HubName = "hubName1")
553554
public SignalRGroupAction addToGroup(
554555
@HttpTrigger(
555556
name = "req",
@@ -569,7 +570,7 @@ The following example removes a user from a group.
569570

570571
```java
571572
@FunctionName("removeFromGroup")
572-
@SignalROutput(name = "$return", hubName = "chat")
573+
@SignalROutput(name = "$return", HubName = "hubName1")
573574
public SignalRGroupAction removeFromGroup(
574575
@HttpTrigger(
575576
name = "req",

includes/functions-bindings-signalr-output-function-json.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Example function.json:
1313
```json
1414
{
1515
"type": "signalR",
16-
"name": "signalRMessages",
17-
"hubName": "<hub_name>",
16+
"name": "signalROutput",
17+
"hubName": "hubName1",
1818
"connectionStringSetting": "<name of setting containing SignalR Service connection string>",
1919
"direction": "out"
2020
}

0 commit comments

Comments
 (0)