| <html> |
| <head><title>castChannel</title></head> |
| <body> |
| <script> |
| var reopened = false; |
| |
| // Executes state transitions: open, close, open, send, receive, send. |
| function openHandler() { |
| if (!reopened) { |
| reopened = true; |
| cast.__platform__.channel.close(function() {}); |
| cast.__platform__.channel.open(openHandler, messageHandler); |
| } else { |
| cast.__platform__.channel.send('reconnected'); |
| } |
| } |
| |
| function messageHandler(data) { |
| cast.__platform__.channel.send('ack ' + data); |
| } |
| |
| cast.__platform__.channel.open(openHandler, messageHandler); |
| </script> |
| </body> |
| </html> |