Skip to content

Commit

Permalink
Jetstream sample
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Oct 19, 2024
1 parent 937d31c commit 81ebb9f
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
18 changes: 18 additions & 0 deletions samples/Jetstream/Jetstream.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\FishyFlip\FishyFlip.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
</ItemGroup>
</Project>
28 changes: 28 additions & 0 deletions samples/Jetstream/Jetstream.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FishyFlip", "..\..\src\FishyFlip\FishyFlip.csproj", "{48260865-FB6C-4F37-B80B-4CF1F8B52E66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jetstream", "Jetstream.csproj", "{D80F3939-6001-4EFE-B574-26771F9B7523}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48260865-FB6C-4F37-B80B-4CF1F8B52E66}.Release|Any CPU.Build.0 = Release|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D80F3939-6001-4EFE-B574-26771F9B7523}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
31 changes: 31 additions & 0 deletions samples/Jetstream/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// <copyright file="Program.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using FishyFlip;
using Microsoft.Extensions.Logging.Debug;

Console.WriteLine("Hello, Jetstream!");

var debugLog = new DebugLoggerProvider();

// You can set a custom url with WithInstanceUrl
var jetstreamBuilder = new ATJetStreamBuilder()
.WithLogger(debugLog.CreateLogger("FishyFlipDebug"));
var atWebProtocol = jetstreamBuilder.Build();

atWebProtocol.OnConnectionUpdated += (sender, args) =>
{
Console.WriteLine($"Connection Updated: {args.State}");
};

atWebProtocol.OnRecordReceived += (sender, args) =>
{
Console.WriteLine($"Record Received: {args.Record.Type}");
};

await atWebProtocol.ConnectAsync();

var key = Console.ReadKey();

await atWebProtocol.CloseAsync();

0 comments on commit 81ebb9f

Please sign in to comment.