Edit in JSFiddle

var client = respoke.createClient();

// "connect" event fired after successful connection to Respoke
client.listen("connect", function(e) {
    alert('Connected to Respoke!');
    console.log("Connected to Respoke!", e);
});

var authenticate = function () {
    $('.join').hide();
    $('.loading').show();
    $.ajax({
        url: 'https://webtask.it.auth0.com/api/run/wt-xander_dumaine-gmail_com-0/respoke-auth',
        type: 'GET',
        data: {
            endpointId: $('#nickname').val() + '@xdumaine-webtask-demo'
        },
        success: function (res) {
            client.connect({
                token: res.tokenId
            });
            $('.loading').hide();
            $('.done').show();
        },
        error: function (err) {
            console.log(err);
            $('.loading').hide();
            $('.error').show();
        }
    });
};
$('#nickname').keypress(function (e) {
  if (e.which == 13) {
    authenticate();
  }
});