faye-server 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +14 -3
- data/VERSION +1 -1
- data/faye-server.gemspec +1 -1
- data/lib/faye-server/faye_server.rb +5 -0
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,11 +1,22 @@
|
|
1
1
|
= faye-server
|
2
2
|
|
3
3
|
Extend FayServer in your class and you will get the following accessors for the class:
|
4
|
-
- messaging_server_options
|
5
|
-
- messaging_server_port
|
4
|
+
- messaging_server_options - passes in options to the faye server, can include faye extensions here
|
5
|
+
- messaging_server_port - sets the port your faye server will listen on
|
6
6
|
With these you can customize your server, including the mount point, timeout, and any extension you want to add.
|
7
7
|
|
8
|
-
This is just a basic wrapper for the Faye::RackAdatper
|
8
|
+
This is just a basic wrapper for the Faye::RackAdatper.
|
9
|
+
It does, however, spawn the Faye server into another thread where it can be monitored and controlled but not lock up your main thread, be it in Rails or any project.
|
10
|
+
|
11
|
+
There are also two more accessors for your class not mentioned above:
|
12
|
+
- messaging_server_thread - Simply the thread running the faye server
|
13
|
+
- messaging_server - the faye server itself
|
14
|
+
|
15
|
+
In your class you can call :start, :stop, :publish.
|
16
|
+
Start/Stop are pretty straight forward, they start and stop the faye server.
|
17
|
+
|
18
|
+
Publish publishes a message to your channel and takes an options hash, requiring a :channel and a :message
|
19
|
+
|
9
20
|
|
10
21
|
== Contributing to faye-server
|
11
22
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/faye-server.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module FayeServer
|
2
2
|
attr_accessor :messaging_server_thread, :messaging_server, :messaging_server_port, :messaging_server_options
|
3
3
|
|
4
|
+
# Starts the Faye Server in a new thread
|
4
5
|
def start(options={})
|
5
6
|
raise 'Already Running' if self.messaging_server and self.messaging_server_thread.status
|
6
7
|
self.messaging_server_thread = Thread.new do
|
@@ -9,6 +10,8 @@ module FayeServer
|
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
13
|
+
# Stops Faye Server
|
14
|
+
# Somtimes Thin will return that it is wating on a client connection and you need to hit "ctrl-c"
|
12
15
|
def stop
|
13
16
|
raise 'Not Running' if !self.messaging_server or !self.messaging_server_thread.status
|
14
17
|
self.messaging_server.stop
|
@@ -19,6 +22,8 @@ module FayeServer
|
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
25
|
+
# Publish a message to a given channel
|
26
|
+
# Requres a :channel, and a :message
|
22
27
|
def publish(options={})
|
23
28
|
raise 'No Channel Provided' if !options[:channel]
|
24
29
|
raise 'No Message Provided' if !options[:message]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faye-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
segments:
|
160
160
|
- 0
|
161
|
-
hash: -
|
161
|
+
hash: -3672171128834934857
|
162
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
163
|
none: false
|
164
164
|
requirements:
|