0.0.120
This commit is contained in:
@@ -21,32 +21,48 @@
|
|||||||
|
|
||||||
|
|
||||||
let url = `ws://localhost:8000/ws/socket-server/`;
|
let url = `ws://localhost:8000/ws/socket-server/`;
|
||||||
|
//
|
||||||
|
// const chatSocket = new WebSocket(url);
|
||||||
|
|
||||||
const chatSocket = new WebSocket(url);
|
// chatSocket.onmessage = function (e) {
|
||||||
|
// let data = JSON.parse(e.data)
|
||||||
chatSocket.onmessage = function (e) {
|
// console.log('Data: ', data)
|
||||||
let data = JSON.parse(e.data)
|
// }
|
||||||
console.log('Data: ', data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// chatSocket.onopen = function () {
|
// chatSocket.onopen = function () {
|
||||||
// console.log("open")
|
// console.log("open")
|
||||||
// }
|
// }
|
||||||
// function open_socket () {
|
// // function open_socket () {
|
||||||
chatSocket.onopen = function(){
|
// chatSocket.onopen = function(){
|
||||||
console.log("open")
|
// console.log("open")
|
||||||
}
|
// // chatSocket
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
chatSocket.onclose = function () {
|
// var i = 0
|
||||||
console.log("close")
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendMessageSocket (data) {
|
function sendMessageSocket (data) {
|
||||||
|
let chatSocket = new WebSocket(url);
|
||||||
|
chatSocket.onopen = function (){
|
||||||
|
console.log("open")
|
||||||
|
chatSocket.send(JSON.stringify(data))
|
||||||
|
}
|
||||||
|
chatSocket.onclose = function () {
|
||||||
|
console.log("close")
|
||||||
|
return false
|
||||||
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// }
|
||||||
// open_socket()
|
// open_socket()
|
||||||
chatSocket.send(JSON.stringify(data))
|
// chatSocket.OPEN
|
||||||
|
|
||||||
|
// chatSocket.onopen = function (){
|
||||||
|
// console.log("open")
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user