зеркало из
1
0
Форкнуть 0
AzureSignalR-samples/samples/Serverless
Liangying.Wei 825fca7dd0
upgrade versions for samples (#129)
2020-03-16 22:34:59 +08:00
..
ClientHandler.cs Update REST API version to v1 2018-10-31 14:28:45 +08:00
Program.cs Add user-secrets support and update readme 2018-07-12 13:24:57 +08:00
README.md Update README.md 2019-06-21 11:00:29 +08:00
ServerHandler.cs Improve response logic and remove old apis 2019-04-01 13:26:50 +08:00
Serverless.csproj upgrade versions for samples (#129) 2020-03-16 22:34:59 +08:00
ServiceUtils.cs Change license & package version 2018-07-09 13:26:56 +08:00

README.md

Azure SignalR Service Serverless Sample

Deprecated

This sample have been deprecated. Users are not recommended to generate access token by themselves. In the Serverless scenario, users are recommended to use Management SDK to build a negotiation server which is responsible for generating access token. For more samples and details, take Management Sample as reference.


This sample is a console app showing the use of Azure SignalR Service in server-less pattern. It provides two modes:

  • Server Mode: use simple commands to call Azure SignalR Service REST API.
  • Client Mode: connect to Azure SignalR Service and receive messages from server.

Also you can find how to generate an access token to authenticate with Azure SignalR Service.

Run the sample

Fist to build the executive file.

dotnet publish -c Release -r win10-x64

Start a client

Serverless.exe client <ClientName> -c "<ConnectionString>" -h <HubName>

Start a server

Serverless.exe server -c "<ConnectionString>" -h <HubName>

Run the sample without publishing

You can just run the command below to start a server or client

# Start a server
dotnet run -- server -c "<ConnectionString>" -h <HubName>

# Start a client
dotnet run -- client <ClientName> -c "<ConnectionString>" -h <HubName>

Use user-secrets to specify Connection String

You can run dotnet user-secrets set Azure:SignalR:ConnectionString "<ConnectionString>" in the root directory of the sample. After that, you don't need the option -c "<ConnectionString>" anymore.

Usage

After the server started, use the command to send message

send user <User Id>
send users <User List>
send group <Group Name>
send groups <Group List>
broadcast