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