I want to create a real time Web chat app.
And trying to do it with ratchet. As a beginner I am not able to understand where I m Goin wrong. I have copied the whole Content from socketo.me and it worked in terminal using "telnet localhost 8080" but when I want to achieve the same thing using my browser it doesn't.
I put localhost:8080 in url and shows blank, where I want to view my index.php.
Plz help me. Where the localhost:8080 is pointing and where should I place my index. Php
You have to create html file containing javascript for you to able to communicate with your websocket server, please refer to ratchet docs (http://socketo.me/docs/push#client).
<script src="https://gist.githubusercontent.com/cboden/fcae978cfc016d506639c5241f94e772/raw/e974ce895df527c83b8e010124a034cfcf6c9f4b/autobahn.js"></script>
<script>
var conn = new ab.Session('ws://localhost:8080',
function() {
conn.subscribe('kittensCategory', function(topic, data) {
// This is where you would add the new article to the DOM (beyond the scope of this tutorial)
console.log('New article published to category "' + topic + '" : ' + data.title);
});
},
function() {
console.warn('WebSocket connection closed');
},
{'skipSubprotocolCheck': true}
);
</script>
use google chrome console to see the logs (F12)