Last active
December 25, 2015 08:19
-
-
Save satbirdd/6945775 to your computer and use it in GitHub Desktop.
sendmessage
This file contains 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
var index = 1; | |
function sendMessage() { | |
var room_name = "中华网军事战略群"; | |
var message = "这是我发送的第 [" + index + "] 条信息"; | |
index ++; | |
$("#room-" + room_name).val(message); | |
setTimeout(function(){ | |
$("#room-" + room_name).trigger("input"); | |
$("button[type=submit]").click(); | |
}, 0); | |
} | |
var time = setInterval(sendMessage, 1000) | |
// ----------直接emit版本--------------------------------------------------------- | |
var index = 1; | |
function sendMessage() { | |
var message = "这是我发送的第 [" + index + "] 条信息"; | |
index ++; | |
socket.emit('chat', JSON.stringify({room: "4MCa4w8FImlU77ePtIdG", msg: message})) | |
} | |
var time = setInterval(sendMessage, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment