4

I am trying to subscribe to realtime data from the ticker plan over a websocket.

I am using .z.ws:{neg[.z.w] -8!value -9!x;} as the ws handler.

I've tested the WebSocket mechanism connecting to rdb successfully. Eg. simple 10#trade returns trade rows. However, when I connect to ticker and attempt .u.sub[trade;AAPL] for example, via websocket, only one message comes and no subsequent updates come.

This works fine when I connect from another q process using hopen...

David Hall
  • 341
  • 2
  • 8

1 Answers1

1

.u.sub pumps via async so you need an async handler on the consumer side. The initial tick you get is just whatever the tickerplant has at that time. I don't think it matters whether you made the initial via websocket.

Try .z.ps:{0!x;} on the client q instance to see whats coming over async.

On the tickerplant you should see the client in the dictionary .z.w

Manish Patel
  • 4,411
  • 4
  • 25
  • 48
  • Thanks for your quick answer. The client is a web browser, not a q process. The websocket has a callback (onmessage) whenever there is data from q server. I was hoping this would be called repeatedly with each update that would have called upd if it were a q client. – David Hall Jul 10 '14 at 09:19