Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/szunami/client-sdk-csharp
https://github.com/szunami/client-sdk-csharp
Last synced: about 21 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/szunami/client-sdk-csharp
- Owner: szunami
- Created: 2022-11-09T18:41:22.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-14T15:43:57.000Z (almost 2 years ago)
- Last Synced: 2023-08-02T22:13:36.157Z (about 1 year ago)
- Language: C#
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hathora C# Client SDK
[![openupm](https://img.shields.io/npm/v/com.hathora.client?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.hathora.client/)
[![NuGet version (Hathora.ClientSdk)](https://img.shields.io/nuget/v/Hathora.ClientSdk.svg?style=flat-square)](https://www.nuget.org/packages/Hathora.ClientSdk/)## Installation
### OpenUPM
```bash
openupm add com.hathora.client
```### Nuget
```bash
dotnet add package Hathora.ClientSdk --version 2.0.0
```## Usage
```csharp
string appId = "...";
Hathora.Client client = new Hathora.Client(appId);
string token = await client.LoginAnonymous();
string roomId = await client.Create(token, new byte[] { });
ClientWebSocket webSocket = await client.Connect(token, roomId);
if (webSocket.State == WebSocketState.Open)
{
ArraySegment bytesReceived = new ArraySegment(new byte[1024]);
WebSocketReceiveResult readResult = await webSocket.ReceiveAsync(bytesReceived, CancellationToken.None);
await webSocket.SendAsync(Encoding.UTF8.GetBytes("{ message: \"Hello world\" }"), WebSocketMessageType.Binary, true, CancellationToken.None);
}```
## Publishing Instructions
### OpenUPM
Update `package.json` version to $VERSION; commit this change.
```bash
git tag $VERSION
git push origin $VERSION
```
Then openUPM will trigger a build pipeline; see https://openupm.com/packages/com.hathora.client/?subPage=pipelines### Nuget
Update the `client-sdk-csharp.csproj` `Version` property to `$VERSION`.
```bash
dotnet pack --configuration Release
nuget push ./bin/Release/Hathora.ClientSdk.$RELEASE.nupkg -Source https://api.nuget.org/v3/index.json
```