README.md in hara-0.2.0 vs README.md in hara-0.2.1
- old
+ new
@@ -7,16 +7,12 @@
Hara's async ability from [em-websocket](https://github.com/igrigorik/em-websocket),
Hara's concurrent ability from [celluloid](https://github.com/celluloid/celluloid).
-Yes, hara just a combination of them, eventmachine and celluloid work well together :)
+Yes, hara is a combination of them, eventmachine and celluloid work well together :)
-## Notice!!
-
-Current API is unstable, you should lock the version.
-
## Installation
Add this line to your application's Gemfile:
gem 'hara'
@@ -27,18 +23,20 @@
Or install it yourself as:
$ gem install hara
-## Usage
+## BasicUsage
*server*
```ruby
#test.rb
require 'hara'
-class Echo < Hara::App
+class Echo
+ include Hara::App
+
define_action :echo do |str|
socket.send str
end
end
```
@@ -57,12 +55,46 @@
*start server*
`ruby test.rb`
`ruby test.rb -h` to view options
-*Other Usage*
+## Other Usages & How it work
-checkout tests
+```ruby
+require 'hara/base'
+
+class Echo
+ #include Hara::App, make you Echo class become Celluloid::Actor and per actor handle a socket
+ include Hara::App
+
+ #Hara::App provide some callbacks
+
+ def after_connect
+ puts 'first called'
+ p headers
+ end
+
+ def before_action action, *args
+ puts 'called when action comming'
+ end
+
+ define_action :echo do |str|
+ puts "#{client_ip} #{client_port}"
+ socket.send str
+ end
+
+ def after_action action, *args
+ puts 'called when action complete'
+ end
+end
+
+#if you require 'hara/base' you need start server you self, like below
+Hara::Server.start 'localhost', '3000'
+```
+
+## RoadMap
+
+js client is processing
## Contributing
1. Fork it
2. Feel free to send pull requests