Sha256: 73ccd630a8ef719b0d5bbafedc40ac2267ad981bed4552ce104a142397f4b3ab

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

# Hara

Hara is a simple framework, help you build websocket server.

## Notice

Current API is unstable, you should lock the version.

## Installation

Add this line to your application's Gemfile:

    gem 'hara'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install hara

## Usage

*server*
```ruby
#test.rb
require 'hara'

class Echo < Hara::App
  define_action :echo do |str|
    socket << str
  end
end
```

*client*
```javascript
var msg = JSON.stringify({action: 'echo',args:['hello world']})
var ws = new WebSocket('ws://localhost:3210')
ws.onmessage = function(msg){console.log(msg.data)}
ws.send(msg)
//hello world
```

*start server*
`ruby test.rb`

`ruby test.rb -h` to view details

## Contributing

1. Fork it
2. Feel free to send pull requests

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hara-0.0.1 README.md