Skip to content

sandbochs/local_message

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LocalMessage Build Status

A Ruby Gem for sending messages as strings across a local network. (UDP style no handshake or acknowledgements)

This was spawned after encountering limitations during a group project at Dev Bootcamp. We had to write a Connect Four clone and play over Twitter. With multiple groups hammering the Twitter API simultaneously we were eventually cut off from the API altogether. Not a single Connect Four game was completed =(.

Todo

  • Markup with Rdoc
  • Add messaging list functionality to send messages to multiple users
  • Add a command to list all registered usernames & messaging lists
  • Add exception handling to the router
  • Add ability to turn console logging on or off for router

Usage

LocalMessageRouter => Maps usernames to ip addresses and a randomly generated port in order to route multiple simultaneous messages across a local network.

router = LocalMessageRouter.new(5000)

Start the router on port 5000

router.start

LocalMessageClient => Interacts with the LocalMessageRouter. Takes the server hostname/ip, listening port, and client username as arguments.

client = LocalMessageClient.new('localhost', 5000, 'sandbochs')

Registers username with the LocalMessageRouter.

client.register

Send a message, 'hello world' to the user, foobar. foobar's client.listen will return '@sandbochs hello world'

client.send_message("@foobar hello world")

Wait for a message from the server, returns a string

client.listen

About

A Ruby Gem for sending messages across a local network.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages