Created
December 12, 2018 22:39
-
-
Save kkworden/2cc3fbf49b5b2a05d6819e1483052f1e to your computer and use it in GitHub Desktop.
Script code for the GraphQL chat API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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