Page 14 of 23

Re: Webserver

Posted: Sat May 07, 2016 8:28 am
by Pako
V_J wrote:File "C:\Program Files (x86)\EventGhost\plugins\Webserver\__init__.py", line 3537, in __call__
print "ERROR "+str(e.code)
AttributeError: 'URLError' object has no attribute 'code'
This is apparently a bug that prevents the listing of any error message.
You can fix this by myself for now. Using notepad.exe open the file __init__.py, which is located in the folder EventGhost\plugins\Webserver.
Find the line 3537, and instead of print "ERROR "+str(e.code)" write only print "ERROR "+str(e)".
It is obvious that even then it will not work. However, you should at least have seen an error message in the log.

Pako

Re: Webserver

Posted: Sat May 07, 2016 9:29 am
by V_J
Thanks! With the correction, I get the following behaviour:
-
event: (empty)
url: http://ip:port/dev/sps/io/variable/value
username: eventghost
password: (empty)
-
gives
-
Webserver: Send event to another webserver:
The authentication line is badly formed.
-
Putting the username in front of the url as so:
-
event: (empty)
url: http://eventghost@ip:port/dev/sps/io/variable/value
username: (empty)
password: (empty)
-
gives
-
Webserver: Send event to another webserver:
This page isn't protected by authentication.
But we failed for another reason.
ERROR <urlopen error [Errno 11003] getaddrinfo failed>
-
If I omit the username entirely, I get the same error as in the first example.


Jörg

Re: Webserver

Posted: Sun May 08, 2016 12:24 pm
by V_J
Googled a bit, and learned that there is an issue with the syntax "http://username:password@website/..."
http://stackoverflow.com/questions/4706 ... -in-python
Could that be the issue in the plugin...?

Re: Webserver

Posted: Sun May 08, 2016 4:27 pm
by Pako
I've done some work on Webserver plugin.
Any errors are corrected, some new actions are added.
I tested it for some time, but it's not enough.
So far, we call it an experimental version.
I ask all users (who use the Webserver plugin) for thorough testing!

Thanks, Pako

Re: Webserver

Posted: Sun May 15, 2016 8:32 pm
by Sem;colon
Tested it for some days now, seems to be working fine (I'm not using web sockets and webserver variables though, so I didn't test them, but the old stuff still works fine :) )

Re: Webserver

Posted: Mon May 16, 2016 12:41 am
by mbonaccors
hey guys, im curious why is it useful to use their variables feature in webserver? I typically set variables directly as eg.globals.variablenames directly via Python scripts. I can call
these via the website anytime using {{eg.globals.variblenames}}. Is there something that I am missing out on?

I also have a question about calling variables from eventghost via my website using angular.js $http.get and/or $http.post. My goal is for the site to dynamically display images, button states etc. dynamically without having to refresh the page to see the result. This the only downside of my current setup is that the objects don't dynamically refresh so I need to reload the page - which is slow and causes various issues. Is this process possible, and does anyone have any example code they could share for me to learn from?


Thanks for the help!

-Matt B.

Re: Webserver

Posted: Mon May 16, 2016 4:07 am
by krambriw
Matt,
You should investigate websockets, that will be the key for you to update single elements in a webpage without doing refresh of the whole. There are several examples in this forum showing code how to use websockets. Try to do a search.

And don't ask the same question in multiple threads!

Re: Webserver

Posted: Mon May 16, 2016 10:59 am
by Pako
I created a simple demo application. You can look here.

Pako

Re: Webserver

Posted: Tue May 17, 2016 1:37 am
by mbonaccors
Thanks so much Pako and Krambriw - I will investigate and learn this. Apologies for the double post, will not do that again!

-Matt B.

Re: Webserver

Posted: Fri May 27, 2016 1:32 pm
by mbonaccors
Pako and Krambriw, thanks so much for your help! I wanted to give you both an update; I have been studying the demo code that Pako put together, and have been learning more JS.. I got it working this morning! This really breaks open the possibilities, very cool stuff.

Re: Webserver

Posted: Thu Jun 09, 2016 7:36 am
by User1306
hi

can someone please help me with a small request.
i'm not that good with java-scripting, (just learning it) but what i want to do is simple i would imagine.
is it possible to have a <div> or <iframe> show and hide based on a variable coming from EG?
i'm using the Test files Pako posted (p12) and doing my own editing to them. i would like to have a div or iframe in the webpage that will show (for example) if i send variable with "show" or "hide".
if someone can suggest what the java script code will be that would be great.

thank you in advance

Re: Webserver

Posted: Thu Jun 09, 2016 1:53 pm
by Pako
I did the modification of demonstration program, which I published here.
You can download a modified file index.html.
Here is an example of how you can control it:
showhide.png
showhide.png (6.2 KiB) Viewed 6380 times
Pako

Re: Webserver

Posted: Fri Jun 10, 2016 4:50 pm
by User1306
Pako Thank you very very much this is exactly what i was looking for
perfect :)

Re: Webserver

Posted: Sat Jun 18, 2016 7:57 pm
by Jabberwock
I wanted to post a bug report (concerning Websockets message), but it turns out that the latest version posted here works perfectly. Now I can use Websockets to control my living-room LEDs with Q Light Controller Plus. Thanks a lot for your work!

Re: Webserver

Posted: Sun Jun 19, 2016 8:55 am
by Jabberwock
Hmm... It seems there is a problem after all... Is the plugin capable of handing a websockets server with a specific URL, e.g.: ws://<ip address>:9999/qlcplusWS ?

EDIT: It is :) I have it working on my testing setup, the problem with the other machine lies elsewhere.