Code Monkey home page Code Monkey logo

local_message's Introduction

local_message

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

local_message's People

Contributors

sandbochs avatar

Watchers

James Cloos avatar Ami avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.