Re: Doubts about the benefits of WebSockets

2014-07-15 Thread Henrik Sarvell
FWIW, in my case I fall back to polling every 10s in case websockets
are not supported. However, as soon as IE9 penetration drops to an
insignificant level I will stop with fallbacks.



On Tue, Jul 15, 2014 at 7:11 PM,  andr...@itship.ch wrote:
 Seems like we have a similar goal, Amaury! Cool :)

 On Mon, Jul 14, 2014 at 03:52:42AM -0700, Amaury Hernández Águila wrote:
 Yeah that would be nice. So, isn't that a good reason to have websockets
 in
 PocoLisp?

 I would not say so. In a video game you have so much continuous
 communication going on (most notably the stream of image frames), that
 you don't need an extra channel.
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


 Online games don't work by feeding single frames to clients. There are now
 a few companies trying to get this alive - like video streaming for games
 - but this not working fluently as the amount of data to transfer when
 rendering images on the server is just too big to have a reasonable
 latency for real-time-games (in opposite to turn based games).

 The continuous communication in a online game is chat and game logic
 messages - user input going up to the server, and results of that inputs
 together with results of behaviour from other agents going down to client

Re: Doubts about the benefits of WebSockets

2014-07-15 Thread andreas
 FWIW, in my case I fall back to polling every 10s in case websockets
 are not supported. However, as soon as IE9 penetration drops to an
 insignificant level I will stop with fallbacks.


Make a user agent statistic from your users, or try to obtain data about
your target audience.
Rumour is, like half of Asia is still running on pirated WinXP using old
versions of IE (even IE6), so its surely good to have fallbacks around.
Of course, this is probably insignificant, but still interesting how
stubborn this old stuff sticks around. A point for trying to make software
well from the start, you never know how long it will haunt you or others
after release...

Mobile support of websockets in the current client versions seems to be
pretty good:  http://caniuse.com/websockets
Question is what version the user-base actually is using...

---
Just some random sources for my statements, not exactly well researched
stuff:

http://www.techinasia.com/windows-xp-now-dead-but-200-million-machines-in-china-still-using-it/

http://www.troyhunt.com/2010/08/aye-pirates-be-reason-ie6-just-wont-die.html


-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-15 Thread Amaury Hernández Águila
How reliable are the statistics from w3schools? (
http://www.w3schools.com/browsers/browsers_stats.asp). It is stated in this
page http://www.w3schools.com/browsers/browsers_explorer.asp that IE6 users
are about 0.1% of the total Internet users.

When I first began web development I always tried to make my websites
compatible with every browser. But now I'm getting tired of that
(particularly, tired of IE) and now I just care about the latest versions
of Chrome and FF. At least this is true for personal projects. I understand
that clients might require their products to be fully compatible with every
browser.


2014-07-15 14:41 GMT-07:00 andr...@itship.ch:

  FWIW, in my case I fall back to polling every 10s in case websockets
  are not supported. However, as soon as IE9 penetration drops to an
  insignificant level I will stop with fallbacks.
 

 Make a user agent statistic from your users, or try to obtain data about
 your target audience.
 Rumour is, like half of Asia is still running on pirated WinXP using old
 versions of IE (even IE6), so its surely good to have fallbacks around.
 Of course, this is probably insignificant, but still interesting how
 stubborn this old stuff sticks around. A point for trying to make software
 well from the start, you never know how long it will haunt you or others
 after release...

 Mobile support of websockets in the current client versions seems to be
 pretty good:  http://caniuse.com/websockets
 Question is what version the user-base actually is using...

 ---
 Just some random sources for my statements, not exactly well researched
 stuff:


 http://www.techinasia.com/windows-xp-now-dead-but-200-million-machines-in-china-still-using-it/


 http://www.troyhunt.com/2010/08/aye-pirates-be-reason-ie6-just-wont-die.html


 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Doubts about the benefits of WebSockets

2014-07-14 Thread Alexander Burger
Hi Henrik,

first of all, thank you for the article and the good work!

However, I must say that I have doubts about the benefits of WebSockets
in general. I cannot see that they are worth the overhead.


They introduce a complicated machinery, which is not just a simple
protocol extension, but a fundamental change in the HTTP transaction
principles. As that, it violates the PicoLisp philosophy of minimizing
the number of concepts.

Second, they require a browser which can handle them. This excludes, for
example, text browsers like 'w3m'.

Third, I'm still waiting for the killer-application which really needs
them. All scenarios I have seen so far can be handled with the standard
PicoLisp framework much more easily - without explicit maintenance tasks
lile clearing out disconnected clients and sending a ping ... to keep
the connection alive. All this is already done automatically.


To keep with the typical realtime chat, a minimal setup could be:


#!/usr/bin/pil

(load @lib/http.l @lib/xhtml.l @lib/form.l)

(de chat ()
   (app)
   (action
  (html 0 Chat @lib.css NIL
 (form NIL
(gui 'log '(+FileField) chat.log 60 20)
(--)
(gui 'msg '(+TextField) 60)
(gui '(+Click +Auto +Button) 2000 'This 2000 Chat
   '(when (val (: home msg))
  (out +chat.log (prinl @))
  (clr (: home msg)) ) ) ) ) ) )

(server 8080 !chat)
(wait)


Put this into a file called chat, set it to executable, and start it
as:

   $ ./chat

Then point some browser windows to http://localhost:8080;. Everything
typed into the 'msg' text field (and even in the 'log' field above it)
appears in all other connected clients after maximally 2 seconds.

Note that also text browsers like w3m can be used. Just the automatic
firing of the button won't happen without JavaScript, so the user must
press the Chat button whenever he wants an update. Also note that due
to the same-origin-policy of JavaScrpt (repeatedly discussed here) the
Chat buttun must be pressed in the beginning once, unless - as usually
recommended - 'httpGate' is running and the client connected directly to
http://localhost;.


Other features like a notification system can be implemented even
simpler. You could, for example, clone the existing 'ping' and 'ping'
functions in @lib/xhtml.l and extend them to carry a payload.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Henrik Sarvell
Hi Alex, doesn't all that polling you're doing introduce a lot of
unnecessary requests to the server.

There can be up to 200 persons logged in at the same time at the site
where I'm using websockets now, that would be 100 HTTP POSTS per
second with full HTTP headers etc just to check for notifications that
perhaps 1 or 2 of them would get per 10 seconds.

See figure 3 here: http://www.websocket.org/quantum.html



On Mon, Jul 14, 2014 at 2:44 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Henrik,

 first of all, thank you for the article and the good work!

 However, I must say that I have doubts about the benefits of WebSockets
 in general. I cannot see that they are worth the overhead.


 They introduce a complicated machinery, which is not just a simple
 protocol extension, but a fundamental change in the HTTP transaction
 principles. As that, it violates the PicoLisp philosophy of minimizing
 the number of concepts.

 Second, they require a browser which can handle them. This excludes, for
 example, text browsers like 'w3m'.

 Third, I'm still waiting for the killer-application which really needs
 them. All scenarios I have seen so far can be handled with the standard
 PicoLisp framework much more easily - without explicit maintenance tasks
 lile clearing out disconnected clients and sending a ping ... to keep
 the connection alive. All this is already done automatically.


 To keep with the typical realtime chat, a minimal setup could be:

 
 #!/usr/bin/pil

 (load @lib/http.l @lib/xhtml.l @lib/form.l)

 (de chat ()
(app)
(action
   (html 0 Chat @lib.css NIL
  (form NIL
 (gui 'log '(+FileField) chat.log 60 20)
 (--)
 (gui 'msg '(+TextField) 60)
 (gui '(+Click +Auto +Button) 2000 'This 2000 Chat
'(when (val (: home msg))
   (out +chat.log (prinl @))
   (clr (: home msg)) ) ) ) ) ) )

 (server 8080 !chat)
 (wait)
 

 Put this into a file called chat, set it to executable, and start it
 as:

$ ./chat

 Then point some browser windows to http://localhost:8080;. Everything
 typed into the 'msg' text field (and even in the 'log' field above it)
 appears in all other connected clients after maximally 2 seconds.

 Note that also text browsers like w3m can be used. Just the automatic
 firing of the button won't happen without JavaScript, so the user must
 press the Chat button whenever he wants an update. Also note that due
 to the same-origin-policy of JavaScrpt (repeatedly discussed here) the
 Chat buttun must be pressed in the beginning once, unless - as usually
 recommended - 'httpGate' is running and the client connected directly to
 http://localhost;.


 Other features like a notification system can be implemented even
 simpler. You could, for example, clone the existing 'ping' and 'ping'
 functions in @lib/xhtml.l and extend them to carry a payload.

 ♪♫ Alex
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Alexander Burger
On Mon, Jul 14, 2014 at 11:41:08AM +0200, Alexander Burger wrote:
 Not such a big problem. If I measure the described chat client, pinging
 every 2 seconds, I get 335 Bytes per second on the average. This amounts
 to 65 kB per second for 200 clients. Not a big problem today. Typically

Oops, no! It is even less than that.

The size I wrote above includes log information like time stamps and
process IDs. Without them, there are only 218 Bytes per second, giving
44 KB per second.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Alexander Burger
Hi Tomas,

 thing like the example from Alex, then the amount of work on the server
 seems rather small and avoiding sending HTTP headers seems like
 pointless micro-optimization.

True. The posts caused by the +Auto button are

   POST /55319/29110032894590418~!jsForm?!chat?*Menu=+0*Tab=+1*ID= HTTP/1.1
   Host: localhost
   User-Agent: Mozilla
   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
   Accept-Language: en-us,en;q=0.5
   Accept-Encoding: gzip, deflate
   Referer: http://localhost/
   Content-Length: 51
   Content-Type: text/plain; charset=UTF-8
   Connection: keep-alive
   Pragma: no-cache
   Cache-Control: no-cache

   *Gui:-3=Chat*Get=1*Form=2*Evt=0*Gui:1=*Gui:2=

with a size of 449 bytes. This is less than the default TCP packet size
of 1152 bytes, so a headerless protcoll wouldn't save anything here.


 What about putting the log field into an iframe with automatic reload
 instead of the +Auto button which needs javascript?  Would that not be
 even better?

I don't know, I have never use iframes. But with them we again introduce
a new concept and new dependencies, which I try to avoid.

The +Auto button is more general, and I use it quite often.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Amaury Hernández Águila
How about a browser videogame? Developing videogames in PicoLisp would be
great. I think I'll start one tomorrow.
El jul 14, 2014 3:21 AM, Alexander Burger a...@software-lab.de escribió:

 On Mon, Jul 14, 2014 at 12:02:10PM +0200, Alexander Burger wrote:
  with a size of 449 bytes. This is less than the default TCP packet size
  of 1152 bytes, so a headerless protcoll wouldn't save anything here.

 Sorry, forget that! I think there is no default TCP packet size :)
 Anyway, we are not talking about huge amounts of data here.

 ♪♫ Alex
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Amaury Hernández Águila
Yeah that would be nice. So, isn't that a good reason to have websockets in
PocoLisp?
El jul 14, 2014 3:49 AM, Alexander Burger a...@software-lab.de escribió:

 Hi Amaury,

 On Mon, Jul 14, 2014 at 03:26:15AM -0700, Amaury Hernández Águila wrote:
  How about a browser videogame? Developing videogames in PicoLisp would be
  great. I think I'll start one tomorrow.

 Really? That would be great! I suspect there are many people here
 interested to help.

 ♪♫ Alex
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Alexander Burger
On Mon, Jul 14, 2014 at 03:52:42AM -0700, Amaury Hernández Águila wrote:
 Yeah that would be nice. So, isn't that a good reason to have websockets in
 PocoLisp?

I would not say so. In a video game you have so much continuous
communication going on (most notably the stream of image frames), that
you don't need an extra channel.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Henrik Sarvell
44KB / second is far from insignificant IMO, it works out to 0.35
Mbit/s if I'm not mistaken, we're paying 20 EUR per month per 1Mbit at
our current co-location. Well worth spending a couple of days to avoid
permanently.

Plus, the goal is to have much much more people logged in in the future.

On Mon, Jul 14, 2014 at 4:52 PM, Alexander Burger a...@software-lab.de wrote:
 On Mon, Jul 14, 2014 at 11:41:08AM +0200, Alexander Burger wrote:
 Not such a big problem. If I measure the described chat client, pinging
 every 2 seconds, I get 335 Bytes per second on the average. This amounts
 to 65 kB per second for 200 clients. Not a big problem today. Typically

 Oops, no! It is even less than that.

 The size I wrote above includes log information like time stamps and
 process IDs. Without them, there are only 218 Bytes per second, giving
 44 KB per second.
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Tomas Hlavaty
Hi Henrik,

 44KB / second is far from insignificant IMO, it works out to 0.35
 Mbit/s if I'm not mistaken, we're paying 20 EUR per month per 1Mbit at
 our current co-location. Well worth spending a couple of days to avoid
 permanently.

wow, 20 EUR per 1Mbit?  160 EUR per 1MByte?  In 2014?  I can't believe
that.  My home connection costs 24 EUR a month without trafic
restrictions iirc and is much faster than that:-)

Cheers,

Tomas
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Henrik Sarvell
Yes but that's a residential subscription, before we moved to
co-location we used fasthosts.co.uk (highly recommended if you don't
do the kind of realtime stuff I do at work).

With fasthosts you get unlimited speed and transfers but when you do
what we do you quickly realize that it doesn't work good because you
have no control over how your boxes are spaced out in the facility. If
some other customer is transferring massive amounts of data between
one of their boxes the quality of your LAN connection could start
suffering. At one point another customer of theirs got attacked by
some kind of denial of service attack which affected us too since it's
all shared.

In the co-lo where we are now we rent space, a whole rack actually, so
our machines are next to each other served by our own switches. This
has resulted in zero network related outages as opposed to the
situation at fasthosts.

To the co-location facility there are 3 geographically separated
uplinks which we buy dedicated space on, ie we have unlimited amount
of transfer per month of course but we have a roof on how much we can
transfer per second (up and down), this roof can be raised by 20 EUR
per Mbit/s per month. We don't share this with anyone else so the
speed is 100% guaranteed, if we don't utilize it that space is not
used, the actions of other customers in the co-location facility can't
affect us as they are also similarly limited in how much they use.

This is working remarkably well, we're not experiencing any network
related issues at all anymore. But it costs...





On Tue, Jul 15, 2014 at 2:00 AM, Tomas Hlavaty t...@logand.com wrote:
 Hi Henrik,

 44KB / second is far from insignificant IMO, it works out to 0.35
 Mbit/s if I'm not mistaken, we're paying 20 EUR per month per 1Mbit at
 our current co-location. Well worth spending a couple of days to avoid
 permanently.

 wow, 20 EUR per 1Mbit?  160 EUR per 1MByte?  In 2014?  I can't believe
 that.  My home connection costs 24 EUR a month without trafic
 restrictions iirc and is much faster than that:-)

 Cheers,

 Tomas
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe