viktor-shmigol / ng2-cable

Connect your Angular(2/4)/ionic(2/3) application with Rails ActionCable
https://ng2-cable-example.herokuapp.com
44 stars 14 forks source link

ng2cable not working with rails action cable it's give error like this #18

Closed mayur-techcompose closed 6 years ago

mayur-techcompose commented 6 years ago

WebSocket connection to 'ws://ec2-198.168.16.5.eu-west-2.compute.amazonaws.com/cable' failed: Error during WebSocket handshake: 'Connection' header is missing

viktor-shmigol commented 6 years ago

@mayur-techcompose It's not related to ng2-cable. Have you added proxy to nginx? Please, take a look at: https://gist.github.com/viktor-shmigol/5c8883aa1c6675cdbc20f530475672ed

mayur-techcompose commented 6 years ago

I am using apache server for rails and I deployed angular application using s3 bucket (Static Web hosting). Can you explain how to set proxy in AWS server? and configure with current domain. Please give more step with explanation.

viktor-shmigol commented 6 years ago

@mayur-techcompose just look it up on the internet. https://www.google.com.ua/search?q=action+cable+apache&oq=action+cable+apache&aqs=chrome..69i57j69i60.4503j0j7&sourceid=chrome&ie=UTF-8 Also you can take a look at: https://gist.github.com/namnv609/a255f5c69018e7d15421f749a4abd5d4

mayur-techcompose commented 6 years ago

@viktor-shmigol Thank you for the help. Now I am not getting any error in console but my message is not broadcasting. In rails console I am getting message Broadcasted but I am not getting any message on front end.

mayur-techcompose commented 6 years ago

this.currentSubscrition = this.broadcaster.on(CreateMessage_${this.communicationChannel.id}).subscribe( message => { this.messages.push(message['message']); this.scrollToBottom(); } );