Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to instantiate LightstreamerClient using .new #153

Open
arvindavoudi opened this issue Jan 23, 2025 · 0 comments
Open

Unable to instantiate LightstreamerClient using .new #153

arvindavoudi opened this issue Jan 23, 2025 · 0 comments

Comments

@arvindavoudi
Copy link

Hi,

I encountered an issue while attempting to use the lightstreamer-client JavaScript library in Python via JSPyBridge. In JavaScript, the library can be imported and used as follows:

const { LightstreamerClient } = require('lightstreamer-client'); 
var lsc = new LightstreamerClient("https://push.example.com", "DEFAULT");

To replicate this functionality in Python, I tried the following code using JSPyBridge:

import javascript as js

ls = js.require("lightstreamer-client")

lsc = ls.LightstreamerClient("push.example.com", "DEFAULT") # This won't work
lsc = ls.LightstreamerClient.new("push.example.com", "DEFAULT") # This won't work as well

However, both attempts result in errors.

  1. The first attempt ls.LightstreamerClient("push.example.com", "DEFAULT") produces the following error:
☕  JavaScript Error  Call to 'LightstreamerClient' failed:
> lsc = ls.LightstreamerClient("push.example.com", "DEFAULT")
  at <module> (.../testjs.py:4)
> 

... across the bridge ...

  at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
  at Readable.push (node:internal/streams/readable:390:5)
  at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
  at addChunk (node:internal/streams/readable:559:12)
  at Socket.emit (node:events:518:28)
  at Socket.<anonymous> (/opt/homebrew/lib/python3.11/site-packages/javascript/js/bridge.js:292:18)
  at Bridge.onMessage (/opt/homebrew/lib/python3.11/site-packages/javascript/js/bridge.js:231:25)
  at Bridge.call (/opt/homebrew/lib/python3.11/site-packages/javascript/js/bridge.js:136:42)
  at Object.z (/opt/homebrew/lib/python3.11/site-packages/javascript/js/node_modules/lightstreamer-client/lightstreamer.js:313:375)
> define("LightstreamerClient","Helpers Global Executor lscC lscE lscD lscAP lscAI lscAO lscAc Inheritance Setter EventDispatcher lscAe EnvironmentStatus IllegalArgumentException Environment LoggerManager IllegalStateException ASSERT lsco lsck ls_sbc BrowserDetection lscAK".split(" "),function(d,f,b,a,c,g,e,p,k,h,l,m,r,n,t,u,q,x,v,A,C,w,H,D,L){function z(b,e){this.C=z;this._callSuperConstructor(z);
🌉 TypeError: this._callSuperConstructor is not a function
  1. The second attempt ls.LightstreamerClient.new("push.example.com", "DEFAULT") leads to this error:
☕  JavaScript Error  Call to '' failed:
> lsc = ls.LightstreamerClient.new("push.example.com", "DEFAULT")
  at <module> (.../testjs.py:5)
> 

... across the bridge ...

  at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
  at Readable.push (node:internal/streams/readable:390:5)
  at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
  at addChunk (node:internal/streams/readable:559:12)
  at Socket.emit (node:events:518:28)
  at Socket.<anonymous> (/opt/homebrew/lib/python3.11/site-packages/javascript/js/bridge.js:292:18)
  at Bridge.onMessage (/opt/homebrew/lib/python3.11/site-packages/javascript/js/bridge.js:231:25)
  at Bridge.init (/opt/homebrew/lib/python3.11/site-packages/javascript/js/bridge.js:128:68)
  TypeError: this.m[ffid] is not a constructor
> ^
🌉 TypeError: this.m[ffid] is not a constructor

It appears that the bridge is unable to handle the instantiation of LightstreamerClient. Could you please provide guidance or any suggestions on how to correctly instantiate this class in Python?

Thanks.

@arvindavoudi arvindavoudi changed the title Unable to instantiate of LightstreamerClient using .new Unable to instantiate LightstreamerClient using .new Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant