Centrifuge 1.0.0
dotnet add package Centrifuge --version 1.0.0
NuGet\Install-Package Centrifuge -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Centrifuge" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Centrifuge --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Centrifuge, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Centrifuge as a Cake Addin #addin nuget:?package=Centrifuge&version=1.0.0 // Install Centrifuge as a Cake Tool #tool nuget:?package=Centrifuge&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Centrifuge C# Client
This SDK provides a client to connect to Centrifugo
⚠️ Working in progress
SDK is not completed yet.
TODO
- Code Refactor
- Nuget
- History
- Presence
Example
using System;
using System.Threading;
using Centrifuge;
namespace Example
{
internal class Program
{
private static string TOKEN = "";
public class TokenGetter : ConnectionTokenGetter
{
public override void GetConnectionToken(ConnectionTokenEvent e, TokenCallback cb)
{
cb(null, TOKEN);
}
}
public class Listener : EventListener
{
public override void OnConnecting(Client client, ConnectingEvent e)
{
Console.WriteLine("onConnecting");
}
public override void OnConnected(Client client, ConnectedEvent e)
{
Console.WriteLine("onConnected");
}
public override void OnDisconnected(Client client, DisconnectedEvent e)
{
Console.WriteLine("onDisconnected");
}
public override void OnError(Client client, ErrorEvent e)
{
Console.WriteLine("onError1" + e.Error);
}
public override void OnMessage(Client client, MessageEvent e)
{
Console.WriteLine("onMessage");
}
public override void OnSubscribed(Client client, ServerSubscribedEvent e)
{
Console.WriteLine("onSubscribed");
}
public override void OnSubscribing(Client client, ServerSubscribingEvent e)
{
Console.WriteLine("onSubscribing");
}
public override void OnUnsubscribed(Client client, ServerUnsubscribedEvent e)
{
Console.WriteLine("onUnsubscribed");
}
public override void OnPublication(Client client, ServerPublicationEvent e)
{
Console.WriteLine("onPublication");
}
public override void OnJoin(Client client, ServerJoinEvent e)
{
Console.WriteLine("onJoin");
}
public override void OnLeave(Client client, ServerLeaveEvent e)
{
Console.WriteLine("onLeave");
}
}
public class SubListener : SubscriptionEventListener
{
public override void OnPublication(Subscription sub, PublicationEvent e)
{
var d = System.Text.Encoding.UTF8.GetString(e.Data);
Console.WriteLine("onPublication" + d);
}
public override void OnJoin(Subscription sub, JoinEvent e)
{
Console.WriteLine("onJoin");
}
public override void OnLeave(Subscription sub, LeaveEvent e)
{
Console.WriteLine("onLeave");
}
public override void OnSubscribed(Subscription sub, SubscribedEvent e)
{
Console.WriteLine("onSubscribed");
}
public override void OnUnsubscribed(Subscription sub, UnsubscribedEvent e)
{
Console.WriteLine("onUnsubscribed");
}
public override void OnSubscribing(Subscription sub, SubscribingEvent e)
{
Console.WriteLine("onSubscribing");
}
public override void OnError(Subscription sub, SubscriptionErrorEvent e)
{
Console.WriteLine("onError" + e.Error);
}
}
public static void Main(string[] args)
{
Options opts = new Options()
{
Token = TOKEN,
TokenGetter = new TokenGetter(),
};
Client client = new Client("ws://localhost:8088/connection/websocket", opts, new Listener());
client.Connect();
var sub = client.NewSubscription("message#0f63396b-3b29-4072-849b-a886ac08a5e2", new SubscriptionOptions(), new SubListener());
sub.Subscribe();
Thread.Sleep(200000);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.8
- Google.Protobuf (>= 3.23.3)
- System.Buffers (>= 4.4.0)
- System.Memory (>= 4.5.3)
- System.Numerics.Vectors (>= 4.4.0)
- System.Reactive (>= 5.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 4.5.3)
- System.Threading.Channels (>= 5.0.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- Websocket.Client (>= 4.6.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 878 | 7/5/2023 |
1.0 version