-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Init * Basic connection and open messages * Able to connect and receive basic messages * Ping pong * Fixing signature issues with Secp256k1 * Adding security to message validation * Adding websockets * Renaming folder * Polish for first draft * BuildAndConnectAsync * OOps * Fixing reading tag if not there for messages * Adding a bypass to bls crytography * Adding comments * Fixing line endings? * Cleanup. Removing MD Api file generator too * Adding tests and docs * Update README.md --------- Co-authored-by: Gekctek <[email protected]>
- Loading branch information
Showing
236 changed files
with
12,481 additions
and
23,716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
// Use IntelliSense to find out which attributes exist for C# debugging | ||
// Use hover for the description of the existing attributes | ||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md | ||
"name": ".NET Core Launch (console)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
// If you have changed target frameworks, make sure to update the program path. | ||
"program": "${workspaceFolder}/src/Sample/bin/Debug/net6.0/Sample.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}/src/Sample", | ||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console | ||
"console": "internalConsole", | ||
"stopAtEntry": false | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach" | ||
} | ||
] | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
// Use IntelliSense to find out which attributes exist for C# debugging | ||
// Use hover for the description of the existing attributes | ||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md | ||
"name": ".NET Core Launch (console)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
// If you have changed target frameworks, make sure to update the program path. | ||
"program": "${workspaceFolder}/src/Sample/bin/Debug/net6.0/Sample.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}/src/Sample", | ||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console | ||
"console": "internalConsole", | ||
"stopAtEntry": false | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}", | ||
"/property:GenerateFullPaths=true" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}", | ||
"/property:GenerateFullPaths=true" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Ethan Celletti | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
Copyright (c) 2022 Ethan Celletti | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
public class AppMessage | ||
{ | ||
|
||
} | ||
|
||
public class WebSocketManager : MonoBehaviour | ||
{ | ||
private Principal devCanisterId = Principal.FromText("{devCanisterId}"); | ||
private Uri devGatewayUri = new Uri("ws://localhost:8080"); | ||
private Uri devBoundryNodeUri = new Uri("http://localhost:4943"); | ||
|
||
private Principal prodCanisterId = Principal.FromText("{prodCanisterId}"); | ||
private Uri prodGatewayUri = new Uri("wss://icwebsocketgateway.app.runonflux.io"); | ||
|
||
private IWebSocket<AppMessage>? websocket; | ||
private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); | ||
|
||
async void Start() | ||
{ | ||
bool development = true; | ||
Principal canisterId; | ||
Uri gatewayUri; | ||
if (development) | ||
{ | ||
canisterId = devCanisterId; | ||
gatewayUri = devGatewayUri; | ||
} | ||
else | ||
{ | ||
canisterId = prodCanisterId; | ||
gatewayUri = prodGatewayUri; | ||
} | ||
var builder = new WebSocketBuilder<AppMessage>(canisterId, gatewayUri) | ||
.OnMessage(this.OnMessage) | ||
.OnOpen(this.OnOpen) | ||
.OnError(this.OnError) | ||
.OnClose(this.OnClose); | ||
if (development) | ||
{ | ||
// Set the root key as the dev network key | ||
SubjectPublicKeyInfo devRootKey = await new HttpAgent( | ||
httpBoundryNodeUrl: devBoundryNodeUri | ||
).GetRootKeyAsync(); | ||
builder = builder.WithRootKey(devRootKey); | ||
} | ||
this.websocket = await builder.BuildAsync(cancellationToken: cancellationTokenSource.Token); | ||
await this.websocket.ReceiveAllAsync(cancellationTokenSource.Token); | ||
} | ||
|
||
void OnOpen() | ||
{ | ||
} | ||
void OnMessage(AppMessage message) | ||
{ | ||
} | ||
void OnError(Exception ex) | ||
{ | ||
} | ||
void OnClose() | ||
{ | ||
} | ||
|
||
void OnDestroy() | ||
{ | ||
cancellationTokenSource.Cancel(); // Cancel any ongoing operations | ||
webSocket?.Dispose(); | ||
} | ||
} |
Oops, something went wrong.