Skip to content

Instantly share code, notes, and snippets.

@kkworden kkworden/script.js

Created Dec 13, 2018
What would you like to do?
Sending chat messages for the GraphQL API
// Sending messages
function sendMessage(nickname, message) {
if (!nickname || nickname == '') {
nickname = '(nobody)';
$.post('/api', { query: `mutation { sendMessage(nickname: "${nickname}", message: "${message}")}`}, getChatroom);
$('#send').click(function() {
var nickname = $('#nickname').val();
var message = $('#message').val();
sendMessage(nickname, message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.