title: Julia ZMQ - connecting to other WebSockets produces StateError
body: <p>I am trying to use ZMQ to connect many publishers to one subscriber (python). This is one such publisher (I use connect instead of bind because the subscriber binds). The code works fine until I unblock the commented code below.</p>
  <p>I then receive this error on <strong>Windows</strong>:</p>
  <pre><code>LoadError: StateError(&quot;Unknown error&quot;)
  </code></pre>
  <p>On <strong>Ubuntu</strong>:</p>
  <pre><code>StateError(&quot;Socket operation on non-socket&quot;)
  </code></pre>
  <p>Source code:</p>
  <pre><code>using ZMQ
  using WebSockets
  using JSON3
  
  const uri = &quot;wss://ws.okex.com:8443/ws/v5/public&quot;
  
  function produce_string()
      return &quot;hi&quot;
  end
  
  function main()
      payload = Dict(
              :op =&gt; &quot;subscribe&quot;,
              :args =&gt; [
                  Dict(
                      &quot;channel&quot; =&gt; &quot;books50-l2-tbt&quot;,
                      &quot;instType&quot; =&gt; &quot;Futures&quot;,
                      &quot;instId&quot; =&gt; &quot;FIL-USD-220325&quot;,
                  ),
              ],
          )
      # Unblock this code to produce error
      # @async while true
      #     WebSockets.open(uri) do ws
      #         confirmation = true
      #         if isopen(ws)
      #             write(ws, JSON3.write(payload))
      #         end
      #     end
      # end
  
      ctx = Context()
      zmq_socket = Socket(ctx, PUB)
      addr = &quot;tcp://localhost:&quot; * string(8093)
      ZMQ.connect(zmq_socket, addr)
      sleep(3)
      ZMQ.send(zmq_socket, &quot;hi&quot;)
  
      while true
          my_string = produce_string()
          ZMQ.send(zmq_socket, my_string)
          println(&quot;sent&quot;)
          sleep(1)
      end
  
  end
  
  main()
  
  </code></pre>