test/dispatch in plezi-0.12.18 vs test/dispatch in plezi-0.12.19

- old
+ new

@@ -23,31 +23,33 @@ end def test data = {} data[:data] ||= "test" {event: 'alert', data: data[:data]}.to_json end - def index - %q{<html><head><script src='/assets/plezi_client.js'></script> + def index event = nil + %q{<html><head><script src='/client.js'></script> </head> <body> <button onclick='connection.emit({event: "test", data: "Woohooo!"});' value='test'>Test!</button> <script> document.body.onload = function() { connection = new PleziClient(); - connection.onalert = function(data) { + connection.alert = function(data) { alert(JSON.stringify(data)); console.log(data); } -// connection.onerr = function(data) { -// alert("Error: " + JSON.stringify(data)); -// console.log(data); -// } + connection.err = function(data) { + alert("Error: " + JSON.stringify(data)); + console.log(data); + } + connection.emit_timeout = 3000; connection.unknown = function(data) { alert("Unknown event: " + JSON.stringify(data)); console.log(data); } } </script></body></html>} end end -host assets: File.expand_path(File.join('..','..', 'resources'), __FILE__) +host +route '/client.js', :client route '/', DispatchTest \ No newline at end of file