Make running the websocket server a little easier
This commit is contained in:
parent
99ad001d28
commit
511a4487de
2 changed files with 13 additions and 1 deletions
5
script/server
Executable file
5
script/server
Executable file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p -v log/thin/
|
||||||
|
bundle exec ruby ./script/websocket_server.rb&
|
||||||
|
bundle exec thin start $@
|
||||||
|
|
@ -19,6 +19,7 @@ def process_message
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
EM.run {
|
EM.run {
|
||||||
Diaspora::WebSocket.initialize_channels
|
Diaspora::WebSocket.initialize_channels
|
||||||
|
|
||||||
|
|
@ -35,7 +36,13 @@ end
|
||||||
ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) }
|
ws.onclose { Diaspora::WebSocket.unsubscribe(ws.request['Path'].gsub('/',''), sid) }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "Websocket server started."
|
puts "Websocket server started."
|
||||||
process_message
|
process_message
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError => e
|
||||||
|
raise e unless e.message.include?("no acceptor")
|
||||||
|
puts "Are you sure the websocket server isn't already running?"
|
||||||
|
puts "Just start thin with bundle exec thin start."
|
||||||
|
Process.exit
|
||||||
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue