added message sending
This commit is contained in:
parent
a48f955914
commit
083ec3e747
|
@ -19,17 +19,18 @@ App['chatroom' + chatroomId] = App.cable.subscriptions.create({
|
|||
connected: () => {
|
||||
},
|
||||
received: data => {
|
||||
console.log(data)
|
||||
}
|
||||
})
|
||||
|
||||
// Testing ActionCable
|
||||
// const testBtn = document.getElementById('test-btn')
|
||||
// testBtn.addEventListener('click', event => {
|
||||
// fetch(`/chat_rooms/${chatroomId}/cable_testing` , {
|
||||
// method: 'POST',
|
||||
// body: JSON.stringify({})
|
||||
// })
|
||||
// })
|
||||
const testBtn = document.getElementById('test-btn')
|
||||
testBtn.addEventListener('click', event => {
|
||||
fetch(`/chat_rooms/${chatroomId}/cable_testing` , {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<button id="test-btn" class="btn btn-primary">Test Connection</button>
|
||||
<div id="join-btn" data-room="<%= @chat_room.id %>"></div>
|
||||
|
||||
<div id="chatroom-hook" data-chatroom-id='<%= @chat_room.id %>'></div>
|
||||
|
|
Loading…
Reference in New Issue