How do you send data to a web socket using curl?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I'm using a bash shell and tryhin gto communicate with a web socket.
I found this script -- https://gist.github.com/htp/fbce19069187ec1cc486b594104f01d0 that is supposed to connect to a web socket, but it doesn't list the parameters if you actually need to pass along data to the endpoint. How is that done?



If curl is not up to the task I'm open to anther command line tool. THe point is not to use curl, but to see stuff in action from the comamnd line.







share|improve this question






















  • There are some useful answers in stackoverflow.com/questions/47860689/…
    – Matheus Santana
    Mar 23 at 11:17










  • Neither of these answers submits data when connecting to teh web socket and one of them uses curl. Am I missing something?
    – Dave
    Mar 23 at 19:06














up vote
1
down vote

favorite












I'm using a bash shell and tryhin gto communicate with a web socket.
I found this script -- https://gist.github.com/htp/fbce19069187ec1cc486b594104f01d0 that is supposed to connect to a web socket, but it doesn't list the parameters if you actually need to pass along data to the endpoint. How is that done?



If curl is not up to the task I'm open to anther command line tool. THe point is not to use curl, but to see stuff in action from the comamnd line.







share|improve this question






















  • There are some useful answers in stackoverflow.com/questions/47860689/…
    – Matheus Santana
    Mar 23 at 11:17










  • Neither of these answers submits data when connecting to teh web socket and one of them uses curl. Am I missing something?
    – Dave
    Mar 23 at 19:06












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm using a bash shell and tryhin gto communicate with a web socket.
I found this script -- https://gist.github.com/htp/fbce19069187ec1cc486b594104f01d0 that is supposed to connect to a web socket, but it doesn't list the parameters if you actually need to pass along data to the endpoint. How is that done?



If curl is not up to the task I'm open to anther command line tool. THe point is not to use curl, but to see stuff in action from the comamnd line.







share|improve this question














I'm using a bash shell and tryhin gto communicate with a web socket.
I found this script -- https://gist.github.com/htp/fbce19069187ec1cc486b594104f01d0 that is supposed to connect to a web socket, but it doesn't list the parameters if you actually need to pass along data to the endpoint. How is that done?



If curl is not up to the task I'm open to anther command line tool. THe point is not to use curl, but to see stuff in action from the comamnd line.









share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 21:43

























asked Mar 22 at 21:28









Dave

368827




368827











  • There are some useful answers in stackoverflow.com/questions/47860689/…
    – Matheus Santana
    Mar 23 at 11:17










  • Neither of these answers submits data when connecting to teh web socket and one of them uses curl. Am I missing something?
    – Dave
    Mar 23 at 19:06
















  • There are some useful answers in stackoverflow.com/questions/47860689/…
    – Matheus Santana
    Mar 23 at 11:17










  • Neither of these answers submits data when connecting to teh web socket and one of them uses curl. Am I missing something?
    – Dave
    Mar 23 at 19:06















There are some useful answers in stackoverflow.com/questions/47860689/…
– Matheus Santana
Mar 23 at 11:17




There are some useful answers in stackoverflow.com/questions/47860689/…
– Matheus Santana
Mar 23 at 11:17












Neither of these answers submits data when connecting to teh web socket and one of them uses curl. Am I missing something?
– Dave
Mar 23 at 19:06




Neither of these answers submits data when connecting to teh web socket and one of them uses curl. Am I missing something?
– Dave
Mar 23 at 19:06










2 Answers
2






active

oldest

votes

















up vote
1
down vote













The script you've found only sends the headers needed to establish the initial Websockets handshake. And you also need to actually show you the headers from the response and understand these to determine if the handshake was successful. But apart from being usable to test the initial handshake curl has no support for Websockets, i.e. it is impossible to actually exchange data using Websockets with curl.






share|improve this answer




















  • Is there another command line tool that does this? I will edit my question b/c I'm not married to curl.
    – Dave
    Mar 22 at 21:42










  • @Dave: A simply search for command line tool websocket provides you with several tools.
    – Steffen Ullrich
    Mar 22 at 21:44

















up vote
0
down vote













I suggest you to use my new tool websocat.



echo "Some data to be sent" | websocat ws://server/url


Obviously, there are also alternatives like wscat (golang) or wscat (node).






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f432940%2fhow-do-you-send-data-to-a-web-socket-using-curl%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    The script you've found only sends the headers needed to establish the initial Websockets handshake. And you also need to actually show you the headers from the response and understand these to determine if the handshake was successful. But apart from being usable to test the initial handshake curl has no support for Websockets, i.e. it is impossible to actually exchange data using Websockets with curl.






    share|improve this answer




















    • Is there another command line tool that does this? I will edit my question b/c I'm not married to curl.
      – Dave
      Mar 22 at 21:42










    • @Dave: A simply search for command line tool websocket provides you with several tools.
      – Steffen Ullrich
      Mar 22 at 21:44














    up vote
    1
    down vote













    The script you've found only sends the headers needed to establish the initial Websockets handshake. And you also need to actually show you the headers from the response and understand these to determine if the handshake was successful. But apart from being usable to test the initial handshake curl has no support for Websockets, i.e. it is impossible to actually exchange data using Websockets with curl.






    share|improve this answer




















    • Is there another command line tool that does this? I will edit my question b/c I'm not married to curl.
      – Dave
      Mar 22 at 21:42










    • @Dave: A simply search for command line tool websocket provides you with several tools.
      – Steffen Ullrich
      Mar 22 at 21:44












    up vote
    1
    down vote










    up vote
    1
    down vote









    The script you've found only sends the headers needed to establish the initial Websockets handshake. And you also need to actually show you the headers from the response and understand these to determine if the handshake was successful. But apart from being usable to test the initial handshake curl has no support for Websockets, i.e. it is impossible to actually exchange data using Websockets with curl.






    share|improve this answer












    The script you've found only sends the headers needed to establish the initial Websockets handshake. And you also need to actually show you the headers from the response and understand these to determine if the handshake was successful. But apart from being usable to test the initial handshake curl has no support for Websockets, i.e. it is impossible to actually exchange data using Websockets with curl.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 22 at 21:33









    Steffen Ullrich

    1,311711




    1,311711











    • Is there another command line tool that does this? I will edit my question b/c I'm not married to curl.
      – Dave
      Mar 22 at 21:42










    • @Dave: A simply search for command line tool websocket provides you with several tools.
      – Steffen Ullrich
      Mar 22 at 21:44
















    • Is there another command line tool that does this? I will edit my question b/c I'm not married to curl.
      – Dave
      Mar 22 at 21:42










    • @Dave: A simply search for command line tool websocket provides you with several tools.
      – Steffen Ullrich
      Mar 22 at 21:44















    Is there another command line tool that does this? I will edit my question b/c I'm not married to curl.
    – Dave
    Mar 22 at 21:42




    Is there another command line tool that does this? I will edit my question b/c I'm not married to curl.
    – Dave
    Mar 22 at 21:42












    @Dave: A simply search for command line tool websocket provides you with several tools.
    – Steffen Ullrich
    Mar 22 at 21:44




    @Dave: A simply search for command line tool websocket provides you with several tools.
    – Steffen Ullrich
    Mar 22 at 21:44












    up vote
    0
    down vote













    I suggest you to use my new tool websocat.



    echo "Some data to be sent" | websocat ws://server/url


    Obviously, there are also alternatives like wscat (golang) or wscat (node).






    share|improve this answer
























      up vote
      0
      down vote













      I suggest you to use my new tool websocat.



      echo "Some data to be sent" | websocat ws://server/url


      Obviously, there are also alternatives like wscat (golang) or wscat (node).






      share|improve this answer






















        up vote
        0
        down vote










        up vote
        0
        down vote









        I suggest you to use my new tool websocat.



        echo "Some data to be sent" | websocat ws://server/url


        Obviously, there are also alternatives like wscat (golang) or wscat (node).






        share|improve this answer












        I suggest you to use my new tool websocat.



        echo "Some data to be sent" | websocat ws://server/url


        Obviously, there are also alternatives like wscat (golang) or wscat (node).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 4 at 17:22









        Vi.

        2,27731936




        2,27731936






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f432940%2fhow-do-you-send-data-to-a-web-socket-using-curl%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay