All Projects → mjaric → fenix

mjaric / fenix

Licence: Apache-2.0 license
.NET implementation of Phoenixframework websocket socket protocol

Programming Languages

C#
18002 projects
elixir
2628 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to fenix

game of life-elixir
An implementation of Conway's Game of Life in Elixir
Stars: ✭ 22 (-21.43%)
Mutual labels:  phoenix-channels, phoenix-framework
poker ex
Texas Hold 'Em app written in Elixir with Phoenix and OTP
Stars: ✭ 58 (+107.14%)
Mutual labels:  phoenix-channels, phoenix-framework
phoenix-channel-client
A Phoenix Channels client library for Elixir.
Stars: ✭ 20 (-28.57%)
Mutual labels:  phoenix-channels, phoenix-framework
Stone
A Swift framework for connecting to Phoenix Channels in your iOS app (with Presence support).
Stars: ✭ 18 (-35.71%)
Mutual labels:  phoenix-channels, phoenix-framework
king of tokyo
👑 King of Tokyo Multiplayer Board Game using Phoenix LiveView
Stars: ✭ 25 (-10.71%)
Mutual labels:  phoenix-channels, phoenix-framework
tutorials as code
so that stuff read/seen don't get muddled up with time
Stars: ✭ 42 (+50%)
Mutual labels:  phoenix-framework
phoenix-and-elm-landing-page
Repo for my "Phoenix and Elm landing page " tutorial series
Stars: ✭ 14 (-50%)
Mutual labels:  phoenix-framework
apollo-phoenix-websocket
An Apollo networkInterface for executing GraphQL queries via Phoenix Channels
Stars: ✭ 91 (+225%)
Mutual labels:  phoenix-channels
distillery packager
Elixir lib for creating Debian and RPM packages with Distillery
Stars: ✭ 25 (-10.71%)
Mutual labels:  phoenix-framework
pharams
Parameter validation for Elixir Phoenix Framework
Stars: ✭ 24 (-14.29%)
Mutual labels:  phoenix-framework
autoform
🤖📝 AutoForm is the simplest way to automatically generate fast, beautiful and standards/WCAG compliant HTML forms based on an Ecto Schema in a Phoenix Web Application to *significantly* speed up Web App Development. 🚀
Stars: ✭ 18 (-35.71%)
Mutual labels:  phoenix-framework
phoenix-postgresql-notify-listen-example
Publish/subscribe with PostgreSQL and Phoenix Framework
Stars: ✭ 16 (-42.86%)
Mutual labels:  phoenix-framework
phoenix live view tablefilter
Table Filter with Phoenix LiveView
Stars: ✭ 15 (-46.43%)
Mutual labels:  phoenix-framework
coophub
Cooperatives repos over the world! 🌈🌎
Stars: ✭ 53 (+89.29%)
Mutual labels:  phoenix-framework
prexent
🎥 Fast, live and beautiful presentations from Markdown powered by Phoenix LiveView
Stars: ✭ 76 (+171.43%)
Mutual labels:  phoenix-framework
phoenix-liveview-15m.twitter
Based on the "real-time Twitter clone in 15 minutes with LiveView and Phoenix", from Chris McCord
Stars: ✭ 40 (+42.86%)
Mutual labels:  phoenix-framework
blog
An example Phoenix 1.3 application
Stars: ✭ 14 (-50%)
Mutual labels:  phoenix-framework
blue bird
API Documentation Generator for the Phoenix Framework
Stars: ✭ 52 (+85.71%)
Mutual labels:  phoenix-framework
phoenix-rethinkdb-elm-webpack-example
Rephink: A real-time stack based on Phoenix Framework, RethinkDB, Elm, Webpack
Stars: ✭ 16 (-42.86%)
Mutual labels:  phoenix-framework
phx raws
Raw websocket server on top of Phoenix.
Stars: ✭ 27 (-3.57%)
Mutual labels:  phoenix-framework

Fenix

Thread safe .NET Standard 2 implementation of Phoenix framework websocket protocol.

Supported/Tested .NET Runtime

  • NETCore 2.1.0
  • Mono 5.16.0.221
  • .NET Framework 4.6 and above

Dependencies:

  • Newtonsoft.Json 12.0.1

Usage

Add Dependency to Fenix NuGet Package

Add Fenix nuget dependency either using your IDEs Package Manager tool or using command line:

$ dotnet add package Fenix

or amend your csproj/vbproj by adding:

<PackageReference Include="Fenix" Version="0.1.*" />

and then build your project for example:

$ dotnet build MyProject.csproj

Create Fenix Socket

use Fenix;


// some constants
const token = "dsa90disadojsaoijadoiajsodiajs";

// Defaults should be ok, but you can tweak some options, e.g. tur on logging, max retries etc.. 
var settings = new Settings();
var socket = new Socket(settings);
try
{
    var uri = new Uri("ws://localhost:4000/socket/websocket");
    // "token" is not required, but below is demo how to pass parameteters while connecting
    await _socket.ConnectAsync(uri, new[] {("token", token)});
    
    var channel = _socket.Channel("room:lobby", new {NickName = "Timotije"});
    channel.Subscribe("new_msg", (ch, payload) =>
    {
        Console.WriteLine($@"
        Got LOBBY message
        {payload.Value<string>("body")}
        ");
    });
    
    var result = await channel.JoinAsync();
    Console.WriteLine($"Lobby JOIN: status = '{result.Status}', response: {result.Response}");
    
    await channel.SendAsync("new_msg", new {body = "Hi guys 2"});
    
    Task.Delay(10000)
        .ContinueWith(async task => { await channel.LeaveAsync(); })
        .ConfigureAwait(false);
}
catch (Exception ex)
{
    Console.WriteLine($"Error: [{ex.GetType().FullName}] \"{ex.Message}\"");
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].