Skip to content

Instantly share code, notes, and snippets.

@kkworden
Created December 12, 2018 22:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kkworden/2cc3fbf49b5b2a05d6819e1483052f1e to your computer and use it in GitHub Desktop.
Script code for the GraphQL chat API
function getChatroom() {
$.post('/api', { query: '{ messages }' }, function(data) {
$('#messages').html(data.data.messages);
});
}
setInterval(function() {
getChatroom();
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment