Webserver

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Webserver

Post by Pako » Sun Jun 19, 2016 9:25 am

Jabberwock wrote:Is the plugin capable of handing a websockets server with a specific URL, e.g.: ws://<ip address>:9999/qlcplusWS ?
Unfortunately, I'm not sure how it is meant.
Webserver plugin has to act as a WebSocket client or as WebSocket server?

Pako
You know flattr ? You can Image

Sem;colon
Plugin Developer
Posts: 697
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Webserver

Post by Sem;colon » Tue Aug 16, 2016 9:38 pm

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!
I can't find any issues (I still don't use websockets though)
If you like my work, Image me a drink :wink:

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Webserver

Post by Aquila » Tue Oct 04, 2016 11:26 am

Hi!

I have been using this plugin with no problem for a long time now. I just upgraded my iPhone to iOS10, and on that phone websockets does not work. It still works on other devices (even iOS9 devices). So the problem is with iOS10. I've been googling the problem, but I can't find an answer that fixes my problem. There has to be some change in how iOS10 uses websockets, but I'm not able to find out what. Anyone have a clue?

m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: Webserver

Post by m19brandon » Thu Oct 06, 2016 1:59 am

Aquila wrote:Hi!

I have been using this plugin with no problem for a long time now. I just upgraded my iPhone to iOS10, and on that phone websockets does not work. It still works on other devices (even iOS9 devices). So the problem is with iOS10. I've been googling the problem, but I can't find an answer that fixes my problem. There has to be some change in how iOS10 uses websockets, but I'm not able to find out what. Anyone have a clue?
I am at a loss too. I thought is was a CSP meta tag thing but I cannot get it working and it works everywhere else outside of iOS10
https://github.com/meteor/meteor/issues/7772

From other forums, I think that the iOS10 WebKit blocks all ws connections. I am going to try wss this weekend but I need to create a cert.

Aquila
Experienced User
Posts: 88
Joined: Wed Jan 28, 2015 2:49 am

Re: Webserver

Post by Aquila » Thu Oct 06, 2016 7:19 am

I've also been playing with the CSP header, but can't get any changes.

I found this: https://java.net/jira/browse/TYRUS-432
If the webserver plugin has the same behaviour, that could explain the disconnect and be easy to fix if one knows where to look.

m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: Webserver

Post by m19brandon » Thu Oct 06, 2016 10:16 pm

No luck last night for me either.

I tried adding the cert, so with https and the js posting to wss:, I still get it working on iOS10 but I did get an error in EG now. In the browser I get 1006.

Code: Select all

2016-10-05 23:14:48  NOTICE: Websocket closing: GOING_AWAY
2016-10-05 23:14:48  EVENT: HTTP.WsClientDisconnected [('192.168.1.203', 49558)]
2016-10-05 23:14:48  INFO: ----------------------------------------
2016-10-05 23:14:48  INFO: Exception happened during processing of request from ('::ffff:192.168.1.203', 49559, 0, 0)
2016-10-05 23:14:48  ERROR: Traceback (most recent call last):
2016-10-05 23:14:48  ERROR: File "SocketServer.pyc", line 599, in process_request_thread
2016-10-05 23:14:48  ERROR: File "SocketServer.pyc", line 334, in finish_request
2016-10-05 23:14:48  ERROR: File "SocketServer.pyc", line 657, in __init__
2016-10-05 23:14:48  ERROR: File "SocketServer.pyc", line 716, in finish
2016-10-05 23:14:48  ERROR: File "socket.pyc", line 282, in close
2016-10-05 23:14:48  ERROR: AttributeError: 'NoneType' object has no attribute 'close'
2016-10-05 23:14:48  INFO: ----------------------------------------
2016-10-05 23:14:48  EVENT: HTTP.20160924 []

m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: Webserver

Post by m19brandon » Fri Oct 07, 2016 12:41 am

Aquila wrote:I've also been playing with the CSP header, but can't get any changes.

I found this: https://java.net/jira/browse/TYRUS-432
If the webserver plugin has the same behaviour, that could explain the disconnect and be easy to fix if one knows where to look.
I am not I fully understood that java.net problem reported.

I tried this https://www.websocket.org/echo.html page my EG Webserver.

If I point to ws://echo.websocket.org/ it works.

If I point to EG Webserver ws://192.168.1.203:8080/ws it fails.

It must be something in the python response somewhere that iOS10 does not like.

eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: Webserver

Post by eirik226 » Tue Oct 18, 2016 9:54 am

I have a Synology NAS home - this is a network storage device and it has the ability to host a webpage and make it available outside your network, I was wondering if it's possible to host the webpage I have created for eventghost on this device?

m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: Webserver

Post by m19brandon » Tue Oct 25, 2016 2:27 am

eirik226 wrote:I have a Synology NAS home - this is a network storage device and it has the ability to host a webpage and make it available outside your network, I was wondering if it's possible to host the webpage I have created for eventghost on this device?
Yes, it should be just html and js files but you would lose all the EG functional.

Why not port forward to your EG machine from your router?
https://portforward.com/router.htm

Sem;colon
Plugin Developer
Posts: 697
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Webserver

Post by Sem;colon » Sat Oct 29, 2016 10:08 pm

Hi Together,

I created a new version of the plugin, this version includes:
-All the changes in 3.12.1
-The changes made to version 3.12 on github to support EG 0.5
-Some fixes for the function "Send event to another webserver" - it never did GET requests, always POST. Now it performs a GET if the parameter "Event" is not specified.


@Pako: All the "experimental" changes from 3.12.1 are in here, I didn't test most of them, so I leave it to you to make a request on github or something to integrate it in the next version of EG or not. Just in case you want to change something.
Attachments
__init__.py
v3.13
(229.14 KiB) Downloaded 193 times
If you like my work, Image me a drink :wink:

mbonaccors
Posts: 16
Joined: Thu Apr 26, 2012 2:46 am

Re: Webserver

Post by mbonaccors » Tue Nov 01, 2016 4:38 am

Hi all,

I have tested the simplest websocket connection html in order to understand why connections in iOS 10 are not happening.

On Desktop Chrome, IE, Firefox etc. The websocket connection works absolutely fine. On iOS 10 Safari it shows the following error message in the safari dev console when trying to connect:
WebSocket connection to 'ws://eventghostwebserver' failed: Invalid HTTP version string: HTTP/1.0
I get this regardless of the HTML that I am running - could this be something regarding the webserver plugin itself? At a bit of a loss on what the issue could be.

m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: Webserver

Post by m19brandon » Thu Nov 03, 2016 1:32 am

Thanks @mbonaccors for the information, you figured it out!!

Python's BaseHTTPServer defaults to HTTP 1.0 to support backwards compatibility. I must have missed that error when debug earlier this month.

I was able get WebSockets on IOS10 working by adding one line of code to the plugin.

Please add "self.protocol_version = 'HTTP/1.1'" to __int__.py at line 1166 and restart EG. It should now work.

Code: Select all

except:
    eg.PrintTraceback()
self.protocol_version = 'HTTP/1.1'  #<<< Add this to line 1166
self.send_response(101, 'Switching Protocols')
self.send_header('Upgrade', 'websocket')
self.send_header('Connection', 'Upgrade')
self.send_header('Sec-WebSocket-Accept', str(digest))
self.end_headers()
self.protocol = 0

Pako and Sem;colon if this works can we get this added to the next version?

mbonaccors wrote:Hi all,

I have tested the simplest websocket connection html in order to understand why connections in iOS 10 are not happening.

On Desktop Chrome, IE, Firefox etc. The websocket connection works absolutely fine. On iOS 10 Safari it shows the following error message in the safari dev console when trying to connect:
WebSocket connection to 'ws://eventghostwebserver' failed: Invalid HTTP version string: HTTP/1.0
I get this regardless of the HTML that I am running - could this be something regarding the webserver plugin itself? At a bit of a loss on what the issue could be.

mbonaccors
Posts: 16
Joined: Thu Apr 26, 2012 2:46 am

Re: Webserver

Post by mbonaccors » Mon Nov 07, 2016 2:43 pm

@m19brandon thank you for the help also! I added your line of code and my webapp is now working perfectly. Good teamwork!

Glad we were able to make it past this issue - cheers!

davidmark
Experienced User
Posts: 85
Joined: Thu Jan 01, 2015 5:25 pm

Re: Webserver

Post by davidmark » Thu Nov 17, 2016 10:52 am

Plug-in decodes using "latin1" instead of the standard "utf-8".

viewtopic.php?f=4&t=9455

There is already a pull request pending review:

https://github.com/EventGhost/EventGhost/pull/116

...though no idea how long that will take. Change is a single string and is as obvious as it is critical. Was ready to dump the Web server a few months back due to related issues and a lack of motivation to delve into the plug-in code. In hindsight, I should have looked as soon as I noticed the exceptions.

Have to ask why this code is being maintained here as opposed to Github. The repository is apparently owned by "Blackwind". Are they still around or are pull requests a waste of time?

As a side note, the Broadcaster plug-in has a similar issue and need somebody to finish what I started here:

viewtopic.php?f=4&t=8222

...As noted, I'm not a real Python programmer and have neither the time nor inclination to become one. I can fix bugs, but can't stand using this BB forum (or wasting time on an untended repository). The forum often times out and loses my replies; have to remember to copy longer posts to the clipboard before sending. Can there be any doubt this project needs a unified (and stable) home to move forward? Saw a thread about the various factions, but I haven't got time to catch up on all that.

Thanks and best of luck!

User avatar
kgschlosser
Site Admin
Posts: 5394
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Webserver

Post by kgschlosser » Thu Nov 17, 2016 6:16 pm

i believe this issue needs to be fixed at the core for triggered events. i will make the repair and send the information over to the powers that be and see if it will get added... the reason why i think it needs to be fixed at the core is because it's really an issue related to the TriggerEvent and also having to go through all of the plugins to correct it a much larger undertaking and it will also take care of any possible problems that can arise from this issue...


but now others know what the issue is and how to fix it..


TY
If you like the work I have been doing then feel free to Image

Post Reply