What is ServerSocket 'a URL ? I set up a web socket with port 4444, and I want to send him data via ajax request from my web application, this requires a URL . Is 127.0.0.1:4444 valid URL value in this case?

    1 answer 1

    A web socket (like any other network socket) must consist of at least an ip address and a port.

    The port you have, it remains to determine the host (IP). Use the domain where the site is located (or, for example, localhost, if you develop the site locally on your machine).

    Example: https://stackoverflow.com/questions/16090530/how-to-point-a-websocket-to-the-current-server

    PS Please do not confuse AJAX and WebSocket. Ajax is one-way клиент->сервер requests. Sockets are a two-way exchange клиент<->сервер .