1

I want to subscribe data from DolphinDB, and I have run these codes in DolphinDB:

share streamTable(10000:0,`time`sym`price`id, [TIMESTAMP,SYMBOL,DOUBLE,INT]) as trades
setStreamTableFilterColumn(trades, `sym)
insert into trades values(take(now(), 10), rand(`ab`cd`ef`gh`ij, 10), rand(1000,10)/10.0, 1..10)

And thes codes in Python:

import dolphindb as ddb
import numpy as np
s = ddb.session()
s.enableStreaming(8000)

def handler(lst):         
    print(lst)

s.subscribe("localhost",8848,handler,"trades","action",0,False,np.array(['ab']))

And I encountered this error:

ERROR in subscribeInternal err: The feature of publish is not enabled.
Retry subscribe in 1 second
ERROR in subscribeInternal err: The feature of publish is not enabled.
Retry subscribe in 1 second
ERROR in subscribeInternal err: The feature of publish is not enabled.
Retry subscribe in 1 second

So how to enable the feature of publish?

Maria
  • 11
  • 1

1 Answers1

1

The python code looks good. However

1) You might double check if you have set parameter maxPubConnection such as the follows. In order to enable publishing, this parameter has to be set on the server side. maxPubConnection=256

2) For robust subscription, it is recommended using ip address such as "127.0.0.1" instead of "localhost".

dovish618
  • 156
  • 5