For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
43 2 6 9

any sample code for WebSocket API SymbolList POST?

does anyone already succeed SymbolList posting via websocket API?

treprdp-apiwebsocketsrrto
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If yes, please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,
AHS

Waiting for @jirapongse.phuriphanvichai to verify a problem that was found by the customer.

A case number is 06263508.

I've checked the case already. There is no further information, so I'll extend its triage to next week.

Case 06263508 is still in progress.

Show more comments
Upvotes
Accepted
78.6k 248 52 74

This appears to be expected behavior from the ADS when a WebSocket App Posts data with the key primitive type of Buffer. The workaround is using AsciiString as the key primitive type. With this type, the data was properly consumed/displayed by both WebSocket and RSSL consumers.

def send_symbol_list_post(ws):
    global post_id   
    sl_post_json = {
        'ID': 1,
        'Type':'Post',
        'Domain':'SymbolList',
        'Key':{          
            'Name': "SYM"            
            },                    
        'Ack':True,
        'PostID':post_id,
        'PostUserInfo': {
            'Address':position,  # Use IP address as the Post User Address.
            'UserID':os.getpid() # Use process ID as the Post User Id.
        },
        'Message': {
            'ID': 257,
            'Type':'Refresh',
            'Domain':'SymbolList',       
            'Key':{            
            'Name': "SYM",           
            'NameType': "Ric"
            },    
            'Solicited': False,
            'Complete' : True,
            'ClearCache' : True,
            'State':{
                'Stream': 'Open',
                'Data': 'Ok',
                'Code' : 'None'
                },
            "Map":{
                "Entries":[
                {
                  "Action":"Add",                  
                  "Key":"RIC1"
                },{
                  "Action":"Add",                  
                  "Key":"RIC2"
                },
                {
                  "Action":"Add",                  
                  "Key":"RIC3"
                }
              ],
              "KeyType":"AsciiString",         
            }
                    }
                }
    ws.send(json.dumps(sl_post_json))
    print("SENT:")
    print(json.dumps(sl_post_json, sort_keys=True, indent=2, separators=(',', ':')))
    post_id += 1
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
78.6k 248 52 74

Yes, I can use off-stream posting to post SymbolList to cache in ADS. You need to have a service that can accept post. The following is code in Python.

def send_symbol_list_post(ws):
    global post_id   
    sl_post_json = {
        'ID': 1,
        'Type':'Post',
        'Domain':'SymbolList',
        'Key':{          
            'Name': "SYM"            
            },                    
        'Ack':True,
        'PostID':post_id,
        'PostUserInfo': {
            'Address':position,  # Use IP address as the Post User Address.
            'UserID':os.getpid() # Use process ID as the Post User Id.
        },
        'Message': {
            'ID': 257,
            'Type':'Refresh',
            'Domain':'SymbolList',       
            'Key':{            
            'Name': "SYM",           
            'NameType': "Ric"
            },    
            'Solicited': False,
            'Complete' : True,
            'ClearCache' : True,
            'State':{
                'Stream': 'Open',
                'Data': 'Ok',
                'Code' : 'None'
                },
            "Map":{
                "Entries":[
                {
                  "Action":"Add",                  
                  "Key":"RIC1"
                },{
                  "Action":"Add",                  
                  "Key":"RIC2"
                },
                {
                  "Action":"Add",                  
                  "Key":"RIC3"
                }
              ],
              "KeyType":"Buffer",         
            }
                    }
                }
    ws.send(json.dumps(sl_post_json))
    print("SENT:")
    print(json.dumps(sl_post_json, sort_keys=True, indent=2, separators=(',', ':')))
    post_id += 1
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
43 2 6 9

Thank you very much for sharing the idea. The data was posted. But when I consume the symbollist, seeing "D" for Name instead of "RIC1" (Xwindow) and other chars on putty. What am I missing?


slpost.png (29.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I got the same issue when subscribing with RSSL 14002. I work fine with WebSocket API.

I will verify the problem.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.