Permalink
Browse files

Fall back to ruby

  • Loading branch information...
1 parent 6e32ee0 commit cfc45f236060a853ab846546540a992b4ac6a676 @kbarrette kbarrette committed Nov 17, 2016
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/websocket/driver.rb
@@ -19,7 +19,15 @@ module WebSocket
class Driver
root = File.expand_path('../driver', __FILE__)
- require 'websocket_mask'
+
+ begin
+ # Load C native extension
+ require 'websocket_mask'
+ rescue LoadError
+ # Fall back to pure-Ruby implementation
+ require 'websocket/mask'
+ end
+
if RUBY_PLATFORM =~ /java/
require 'jruby'

0 comments on commit cfc45f2

Please sign in to comment.