Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REMOTE KONSOLE - SignalR/server send events React "Konsole" #67

Open
goblinfactory opened this issue Nov 13, 2020 · 0 comments
Open

REMOTE KONSOLE - SignalR/server send events React "Konsole" #67

goblinfactory opened this issue Nov 13, 2020 · 0 comments
Labels
blue skies suggested by someone and hellyeah we're gonna do it

Comments

@goblinfactory
Copy link
Owner

goblinfactory commented Nov 13, 2020

SignalR/server send events React "Konsole"

The idea is to be able to drop in a text console "widget" into a webpage, e.g. a React control, or even in a static CDN website, that loads a console with a unique session ID, app ID and string[] channels. Then be able to treate writing to a remote console as simple as writing to a konsole window, with some extra support for broadcasting to channels, as well as processing user input.

for example, in a game; where the statusbar channel, is defined client side using normal console commands, window.SplitLeft(), splitColumns for example

 // below code would be converted to javascript / react so shown only as pseduo code for converting to react.
  var rows = layout.SplitRows(
                    new Split(3, "headline", LineThickNess.Single, ConsoleColor.Yellow),
                    new Split(0, "content", LineThickNess.Single),
                    new Split(3, "status", LineThickNess.Single, ConsoleColor.Yellow)
            );
  var rc = new remoteConsole(appId, appUrl, authtoken);
 var header = new remoteConsole(rc, rows[0], "header");
var content = new remoteConsole(rc, rows[1],"content");
 var status = new remoteConsole(rc, rows[2], "statusBar"); 
  rc.Render();
  rc.HandleEvents(myCancellationToken);

then server side you can write

var (deadUser, restOfUsers) = GetNextVictim(); // returns sessionIDs used to communicate with remote users.

var rc = new RemoteConsole(appId, appUrl, token);

var contentAll = rc.BroadCast.ToChannel("content").ToAllExcluding(deadUser.SessionId);
contentAll.WriteLine(Yellow, $"{deadUser.Name} was killed by the wearwolf.");

var contentDead = rc.SingleCast(deadUser.SessionId).ToChannel("content"):
contentDead.WriteLine(Red, $"You have been killed by the wearwolf.");

var statusAll = rc.BroadCast.ToChannel("status");
statusAll.WriteLine($"Only {cnt} players left alive!");
@goblinfactory goblinfactory added blue skies suggested by someone and hellyeah we're gonna do it help wanted labels Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blue skies suggested by someone and hellyeah we're gonna do it
Projects
None yet
Development

No branches or pull requests

1 participant