Subscribe/unsubscribe multiple stream


We are trying to subscribe two streams(multiple) at same time. The hash is generated and added to list. We are trying to call the subscribe() in StreamConsumer and it is not at all being called. On the other hand we are trying to call subscribe () in HttpMulti. The problem is we are not able to invoke HttpMulti as we do not know the 3rd param it takes.

While stopping the stream, we are passing the corresponding hash to unsubscibe() of Stream Consumer. The total connection is lost. How should we stop only the stream for which hash is passed?

Thank you.
Balaji D.


We are trying to connect with Websocket. We are using MultiStream in which we have changed the protocol to WS. The subscribe method takes the hash. What is the correct way to invoke datasift api thru WS. Is consume() method an alternate to subscribe()? Kindly guide me.


Have you taken a look at our HTTP MultiStream and WS MultiStream examples?

When using WebSockets for multi-streaming, you should start by simply connecting to the API by calling the StreamConsumer consume() method. After this, you can subscribe to new streams using the StreamConsumer subscribe() method.