Coder Social home page Coder Social logo

wipes's Introduction

wipes - Pipe text to a WebSocket server

Summary

wipes is a simple Go program that reads from STDIN and demuxes lines to open WebSockets. For convenience, it also serves files over HTTP (defaulting to the local directory) such that you can talk to the WS server easily.

Installation

$ go get github.com/gorilla/websocket
$ go build

Usage

The idea of wipes is that it's part of a command pipeline. Thus:

$ tail -f /var/log/messages | wipes -addr :8080

Will start an HTTP server on 8080 and serve files from the current directory. It will also make available the output of tail -f /var/log/messages available via WebSockets at ws://localhost:8080/_ws.

It's possible to serve a different directory:

$ tail -f /var/log/messages | wipes -static /var/www/wsapp

wipes will exit with status 0 when there's nothing left to read.

Examples

Anything that provides a constant stream of data makes sense to use here. In the examples directory, there's a simple HTML doc with a WS client that just displays a line at a time. To test it out, we'll make use of Meetup's streaming API, specifically, the /2/rsvps endpoint.

$ curl http://stream.meetup.com/2/rsvps | wipes -static examples

Then, open your browser to http://localhost:8080/lines.html. The result should be lines of JSON formatted text.

See Also

websocketd

Like inetd, but for WebSockets. Turn any application that uses STDIN/STDOUT into a WebSocket server.

websocketd

Contributing and Feedback

It's possible that wipes has bugs, and/or does something it shouldn't be, and/or has lots of room for improvement. If you'd like to fix or contribute something, please fork and submit a pull request, or open an issue.

If you have any other feedback, feel free to email me at the below address.

Authors

Andrew Gwozdziewycz [email protected]

Copyright

Copyright 2014, Andrew Gwozdziewycz, [email protected]

Licensed under the GNU GPLv3. See LICENSE for more details.

wipes's People

Contributors

apg avatar jebjerg 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.