Currently, I am developing two webapps :
- the core, developed in Java with Vert.x, receives data from a lot of other apps and sends it to client)
- the client, developed in PHP/JS, display data from the core.
The client isn't on the same domain as my core for the production phase.
Since my development period, the two webapps are hosted in the same puter. I used "ws:\\localhost:9090" to connect my client to my core and I had no problem to transfer data.
But, today, I try to replace localhost with my IP Address and, it didn't work :s
I think that it's because the client isn't in the same domain as the core. But I don't know how I can correct this problem ?
Do you have any idea ?
Thanks !
Code example (based on my code but not my code ;) ):
- For the core :
- For the client :
Currently, I am developing two webapps :
- the core, developed in Java with Vert.x, receives data from a lot of other apps and sends it to client)
- the client, developed in PHP/JS, display data from the core.
The client isn't on the same domain as my core for the production phase.
Since my development period, the two webapps are hosted in the same puter. I used "ws:\\localhost:9090" to connect my client to my core and I had no problem to transfer data.
But, today, I try to replace localhost with my IP Address and, it didn't work :s
I think that it's because the client isn't in the same domain as the core. But I don't know how I can correct this problem ?
Do you have any idea ?
Thanks !
Code example (based on my code but not my code ;) ):
- For the core : http://pastebin./h2ZnBvQJ
- For the client : http://pastebin./DR5BeABf
1 Answer
Reset to default 0Yes, Websocket can do cross-domain, but you will need to have a handshake in order to get this going. You might want to take a look at: http://en.wikipedia/wiki/WebSockets for an example of a handshake.
Also related and maybe duplicate: Web sockets make ajax/CORS obsolete?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745346644a4623580.html
评论列表(0条)