Hi,
I admit, I am a newbie… but I simply try to reproduce the example for a simple server response:
form:
from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
class Form1(Form1Template):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run when the form opens.
def button_1_click(self, **event_args):
"""This method is called when the button is clicked"""
result = anvil.server.call('say_hello', 'hello developer')
print(result)
server side:
import anvil.server
# This is a server module. It runs on the Anvil server,
# rather than in the user's browser.
#
# To allow anvil.server.call() to call functions here, we mark
# them with @anvil.server.callable.
# Here is an example - you can replace it with your own:
#
@anvil.server.callable
def say_hello(name):
print("Hello, " + name + "!")
return 42
I keep getting: " Exception: Connection to server failed at [Form1, line 15]"
Probably I made a stupid mistake. However, any kind help is very welcome!
Vinz
Edit:
Clone Link: https://anvil.works/build#clone:FVRHWGJIWEFDLPCD=MQMN5CGYSP2RXI5UEFLBHQ2P
Summary
Edit2:
The frustrating truth: our firewall/proxy blocks the request from the client side to the server side. The application would work…
EDIT 3:
A further update: It turns out finally that the proxy was only part of the problem. Second part of the problem is Firefox as a Browser. There was a problem with a setting in Firefox (to be found in about:config):
The setting was set to True in my browser. Once set to False, the problem with the app disappeared. I am using FF 68.9.0esr as a browser. Google SPDY seems to have a problem with my version of Firefox. Funnily the app works with Chrome (however, I experienced other problems regarding Anvil and our Proxy). According to our network team the problem is a combination of the proxy and SPDY protocol implementation in our version of Firefox. Thanks for all answers.