Sha256: e4c58f5b0efa95b372de0c033f2e986607a37317c7441e1c98f2438930730515
Contents?: true
Size: 562 Bytes
Versions: 26
Compression:
Stored size: 562 Bytes
Contents
# frozen_string_literal: true require 'bundler/setup' require 'tipi' require 'localhost/authority' def ws_handler(conn) while (msg = conn.recv) conn << "you said: #{msg}" end end authority = Localhost::Authority.fetch opts = { reuse_addr: true, dont_linger: true, upgrade: { websocket: Polyphony::Websocket.handler(&method(:ws_handler)) }, secure_context: authority.server_context } puts "pid: #{Process.pid}" puts 'Listening on port 1234...' Tipi.serve('0.0.0.0', 1234, opts) do |req| req.respond("Hello world!\n") end
Version data entries
26 entries across 26 versions & 1 rubygems