question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to call function on client from server?

See original GitHub issue

I am trying to replace the eel package with the guy package. One thing I can not understand from the documentation is how I would go about calling a function on the client (javascript) from my python backend. So what I am trying to do is: Python:

def print_on_client(message):
    guy.call("print", message)

print_on_client("hello world")

Javascript:

function print(message){
    console.log(message);
}

I would expect the client printing “hello world” in the console. What would be the correct way to achieving this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
manatlancommented, Feb 1, 2020

The 0.4.3 is here … See : https://github.com/manatlan/guy/blob/master/testEelHelloWorld.py

I will update the doc 😉 … it’s a nice feature

1reaction
manatlancommented, Feb 1, 2020

Stay tuned …

coz, the next version will implement a way to call directly a js method … from py side, without using events (I’m making a layer on top of that, to abstract the concept)

you could use :

    await self.js.say_hello_js("Python World!")

in place of :

    await self.emitMe("say_hello_js","Python World!")
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to call a server-side function from client-side?
It is possible to call server-side functions in client-side code using the ~% syntax. For security reasons, these functions must first be declared ......
Read more >
Calling a client side function from server side in node.js
If it's necessary to call client side function from server then you will need some kind of open connection like Websockets, and on...
Read more >
How to call server side function on client side - MSDN - Microsoft
Hi, How to call server side function on client side? here i want to call change() function on textbox onchange event. <script language=" ......
Read more >
Solved: How to call function from server to html
I can do this on client script, but its not working on server script. HTML : <button ng-click="c.data.getcc()"> search </button> <span> ...
Read more >
How to call Server function from client on a level placed ...
I have an Actor placed on a level, and I would like to be able to call a Server function from a client....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found