i'm totally new in socket.io. In this case i'm trying to get response from my own REST. Why Socket.io can't rendering new resource when i create some resource in my REST. This is my source code. I'm using rest-client library for consume my RESTfull
//app.js
...
io.on('connection', function(socket){
client.get("http://localhost:8001/transaksi", function(data){
socket.emit('test', data.idtransaksi);
});
And this is my client
//index.html
...
<script>
var socket = io('localhost');
socket.on('test', function(test){
console.log(test);
});
</script>
And worked afer i refresh the page. But, i want get real-time response.
Sorry for bad grammar
via Ade Firman Fauzi
No comments:
Post a Comment