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
#!/usr/bin/env ruby | |
# Run with: ruby server_sent_events.rb | |
# Test with: curl -vNH 'Accept: text/event-stream' -H 'Last-Event-ID: 1' -H 'Cache-Control: no-cache' http://localhost:63310 | |
require 'time' | |
require 'reel' | |
class ServerSentEvents < Reel::Server | |
include Celluloid::Logger | |
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
/* | |
Copyright (C) 2013 Hendrik Beskow | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to | |
deal in the Software without restriction, including without limitation the | |
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
sell copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
source 'https://rubygems.org' | |
gem 'redis-pool' | |
gem 'celluloid-redis' | |
gem 'ohm' |
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
source 'https://rubygems.org' | |
platform :rbx do | |
gem 'rubysl' | |
end | |
gem 'reel', github: 'celluloid/reel' | |
gem 'websocket-driver' | |
gem 'rack' |
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
-----BEGIN CERTIFICATE----- | |
MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MRAwDgYDVQQDDAdoZW5k | |
cmlrMRYwFAYKCZImiZPyLGQBGRYGYmVza293MRIwEAYKCZImiZPyLGQBGRYCZGUw | |
HhcNMTQwMzAzMTgwNTUzWhcNMTUwMzAzMTgwNTUzWjA+MRAwDgYDVQQDDAdoZW5k | |
cmlrMRYwFAYKCZImiZPyLGQBGRYGYmVza293MRIwEAYKCZImiZPyLGQBGRYCZGUw | |
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrjCXwi7K4cXvKjVrlFNDM | |
USTsUPwdgnAF8mEGUmm4Xb2njK2gq+D3+i6krQCDiqBvi5h2EG/LK21mDWnkFc3t | |
809/F3KlPh+otlnL4UQFZNsGNgDHKmTMRfoaR+fOHouRxJQx0qEBf2fbKX/1/DeI | |
2APra5nRS/nbduIrYeO3zV+P0dGswyWot56K3wWGNA4LvYvpn0b6GYMm1JTOd+Ld | |
2gl+nxy7Bxu2cArOHwjcv59MsQNnaO9L9Un8AI0ZYCSL1vtfNycvAdcjsc7WiLEH |
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
require 'rbnacl' | |
require 'celluloid/zmq' | |
require 'socket' | |
if Celluloid::ZMQ::VERSION == "0.15.0" | |
module Celluloid | |
module ZMQ | |
def self.evented? | |
actor = Thread.current[:celluloid_actor] | |
actor.mailbox.is_a?(Celluloid::ZMQ::Mailbox) |
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
require 'json' | |
require 'active_support/core_ext/numeric/bytes' | |
require 'delegate' | |
require 'forwardable' | |
require 'time' | |
require 'celluloid/io' | |
require 'websocket/driver' | |
require 'webmachine' | |
require 'webmachine/adapters/rack' | |
require 'celluloid/autostart' |
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
source 'https://rubygems.org' | |
gem 'pry' | |
platforms :ruby do | |
gem 'msgpack' | |
end | |
platforms :jruby do | |
gem 'msgpack-jruby', :require => 'msgpack' | |
end |
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
require 'ffi' | |
require 'benchmark' | |
module LibC | |
extend FFI::Library | |
ffi_lib FFI::Library::LIBC | |
attach_function :malloc, [:size_t], :pointer | |
attach_function :free, [:pointer], :void | |
end |
OlderNewer