Skip to content

Instantly share code, notes, and snippets.

@farnoy
Created May 27, 2015 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farnoy/32364f5ad91618937ce6 to your computer and use it in GitHub Desktop.
Save farnoy/32364f5ad91618937ce6 to your computer and use it in GitHub Desktop.
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