VisualStudioEX3 / FleckTest

A little chat console program to test Fleck websockets library and IoC with Microsoft Dependency Injection library, developed in C# using .NET Core 3.1.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FleckTest

A little chat console program to test Fleck websockets library and IoC with Microsoft Dependency Injection library, developed in C# using .NET Core 3.1.

FleckTest.jpg

Usage

Type FleckTest.exe %PORT_NUMBER

  • The program has two behaviours on the start process:
    • First tries to connect as client to server address (in fact, for testing pourposes, currently the address always is localhost) and a port passed as argument.
    • If the connection failed, assumed to the server is not running. Then starts the creation server proccess.

Overview and feature list

  • The client currently only implements a basic command to terminate chat session and close the program, exit.
  • The server supports, in theory (not tested it), an unlimited user sessions in the unique chat room.
  • Each user has able to register an unique username, any value and length except empty string or spaces.
  • The server assign an one color scheme to each user (12 variations).
  • User messages can be any string value and length except empty string or spaces.
  • The server can detect any client lost connection (the client crash or exit using the close window command instead of exit command) to avoid active ghost/abandoned sessions. The clients, at now, only catch the error when trying to send a message to a server that was crashed o not closed properly.

FYI: The Visual Studio project has defined a port number in debug profile (Project Properties -> Debug tab). You can run multiple instances of the program to run server and multiple clients (using Debug->Start New Instance command from context menu on project item in Solution Explorer window).

Issues/bugs

  • Sometimes, the prompt/input line is not deleted by the last user message printed in console.
  • Sometimes, the messages not uses the right color assigned.
  • Multiline messages not delete properly the last prompt/input printed line.
  • The above issues seems to be because a bad tasks synchronization when changed the console settings and cursor position corrections (necessary to the right prompt behaviour, for example).

TODO list

  • Implementing ping-pong task or similar in client to check state of the server (to end session in client when the server connection is lost).
  • Basic encryption on socket messages (this would be easy to implement in the ServerMessage model implementation).
  • Additional commands like "ping", to send beep sound to all users or an especific user maybe, for example (this might need to extend the IUserInputCommandProcessor service interface).

Disclaimer

This is a side project developed as result of a technical test for a job interview and a way to learn new technologies and common practices. Not intended to be a serious project or final product in the future.

About

A little chat console program to test Fleck websockets library and IoC with Microsoft Dependency Injection library, developed in C# using .NET Core 3.1.

License:MIT License


Languages

Language:C# 100.0%