diff --git a/static/sync/index.js b/static/sync/index.js index d585191..45f28cd 100755 --- a/static/sync/index.js +++ b/static/sync/index.js @@ -19,6 +19,13 @@ $(function () { $.getJSON('/token', function (tokenResponse) { //Initialize the Sync client syncClient = new Twilio.Sync.Client(tokenResponse.token, { logLevel: 'info' }); + syncClient.on('connectionStateChanged', function(state) { + if (state != 'connected') { + $message.html('Sync is not live (websocket connection ' + state + ')…'); + } else { + $message.html('Sync is live!'); + } + }); //Let's pop a message on the screen to show that Sync is ready $message.html('Sync initialized!');