Created
December 4, 2017 14:12
-
-
Save typewriter/d3b42b9442f3ec964972864f6a4bb808 to your computer and use it in GitHub Desktop.
Server Sent Events (SSE) Client with Ruby
This file contains 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
# Server Sent Events (SSE) Windows Client sample | |
# (but cannot install/load em-eventsource) | |
require 'win32ole' | |
require 'em-eventsource' | |
# Windows Script Host :( | |
shell = WIN32OLE.new('Shell.Application') | |
wsh = WIN32OLE.new('Wscript.Shell') | |
EM.run do | |
source = EventMachine::EventSource.new("http://example.com:8080/subscribe") | |
source.message do |message| | |
shell.MinimizeAll | |
wsh.Run message | |
end | |
source.start | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment