2

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 computer. 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 ;) ):

guido
  • 18,864
  • 6
  • 70
  • 95

1 Answers1

0

Yes, 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.org/wiki/WebSockets for an example of a handshake.

Also related and maybe duplicate: Web sockets make ajax/CORS obsolete?

Community
  • 1
  • 1
Daniel
  • 179
  • 2
  • 9
  • Thank you for your answer but I have "resolved" my problem. I use a proxy and Wireshark show that this proxy cut my websocket http header. So my core didn't see the websocket connection. Without this proxy, the websocket works... –  Jun 04 '14 at 08:41
  • Use wss:// (secure) connection then. Some proxies are not WS friendly and they try to alter the headers like in a normal HTTP request. Some proxies for example remove the "Upgrade:websocket" header (because is marked as "Connection"). – vtortola Jun 05 '14 at 00:07