2 Replies Latest reply on Nov 13, 2018 7:51 AM by Amey BHATKAR

    Documentation for Javascript API

    Amey BHATKAR

      Is there a document, post or a link from Zebra officially to explain how we can communicate with the printers with WebSocket using JavaScript as a language?


      I have checked quite a few links and documentations from the Zebra web site, but was unable to print anything through a ws connection.


      I was able to receive the discovery message after the Main channel was opened:


      "discovery_b64" : "OiwuBAIBAAFaQlIAAFgAAAA ..."



      But after that, I was unable to connect with either a Raw Channel or a Configuration Channel, and thus unable to print anything from Javascript in the end.


      It would be a great help if you can send the official documentation or even blogs (I couldn't find any) which specify on how I can print with JavaScript.


      Thanks in advance.

        • Re: Documentation for Javascript API
          Brian Moore



          The documentation that you are looking for can be found in the Link-OS Multiplatform SDK | Zebra


          Once this is installed, the websocket documentation can be found at the following path (assuming you installed to C:\)


          C:\Program Files\Zebra Technologies\link_os_sdk\Webservices\v2.14.5198\documentation\Weblink WebSocket Endpoint Configuration.pdf



          Brian Moore

          Software Engineer Kutir Mobility

          Posted on behalf of Zebra Technologies

          • Re: Documentation for Javascript API
            Amey BHATKAR

            We have read the documentation available online here



            The details on our tests :


            1. We have created our proper webSocket server node.js, with our endpoint
            2. We have launched the webSocket server
            3. We have configured the printer to connect on our endpoint with a tool jar
            4. We see on our log the packet { "discovery_b64" : "OiwuBAIBAAFaQlIAAFgAAAA ..." }. It means the printer is connected on the Main Channel.
            5. Then for printing, we try to open the raw channel with the command in JSON : { "open" : "v1.raw.zebra.com” } , sent on the Main channel.
            6. Normally we must receive the message { "unique_id" : "XXXYYYZZZ", "channel_name" : "v1.raw.zebra.com", "channel_id" : "2" } but we receive nothing, and the websocket client disconnects, with the error 1003.
            7. On documentation the explanations about the error 1003 are : « However, the printer only supports Binary frames. If the printer receives text frames it will terminate the connection with response code 1003 indicating that only binary frames are acceptable. »


            The question : why after sending the command { "open" : "v1.raw.zebra.com" }, the printer disconnect from webSocket server ?


            PS: We converted the JSON command in Base 64 and Binary for sending to printer after reading the point 7 above, but that resolved nothing.