Sha256: c17296ec6fb2c54824472871805676227b38422c2d9cdbd597086845384ff8bc
Contents?: true
Size: 790 Bytes
Versions: 3
Compression:
Stored size: 790 Bytes
Contents
# Replace this sample with real code. class ExampleCtrl # HTTP def index # any String returned will be appended to the response. We return a String. render 'welcome' end # Websockets def on_message(data) data = ERB::Util.html_escape data print data broadcast :print, data end def on_open print 'Welcome to appname!' @handle = params['id'.freeze] || 'Somebody' broadcast :print, "#{ERB::Util.html_escape @handle} joind us :-)" end def on_close broadcast :print, "#{@handle} left us :-(" end protected # write is inherites when a Websocket connection is opened. # # Inherited functions aren't exposed (for our security), so we need to wrap it. def print(data) write data end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
plezi-0.14.9 | resources/ctrlr.rb |
plezi-0.14.8 | resources/ctrlr.rb |
plezi-0.14.7 | resources/ctrlr.rb |