Created
May 27, 2015 20:10
-
-
Save farnoy/32364f5ad91618937ce6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clients = [] | |
message_queue = [] | |
# entrypoint websocketa | |
def incoming_request(connection) | |
clients.push(connection) | |
end | |
Thread.new do | |
while x = message_queue.shift | |
clients.each { send_message(client, x) } | |
end | |
end | |
# web appka gdzieś, podczas requestu: | |
message_queue.push("mleko") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment