libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] integration with my websockets


From: José Bollo
Subject: Re: [libmicrohttpd] integration with my websockets
Date: Tue, 11 Apr 2017 19:23:39 +0200

On Tue, 11 Apr 2017 20:04:37 +0300
Evgeny Grin <address@hidden> wrote:

> Hi José,
> 
> On 11.04.2017 19:55, José Bollo wrote:
> > On Tue, 11 Apr 2017 18:29:04 +0200
> > José Bollo <address@hidden> wrote:
> >  
> >> I just found time now to integrate the work you did last summer
> >> for upgrading connections. Seems to work out of the box, but...
> >>
> >> First a remark: I was previously trying to allocate ressources for
> >> the web socket before to reply to the upgrading connection. That
> >> is not more possible except if I create the websocket without
> >> socket. That is a detail but a not pleasant detail.  
> Could you explain a bit more do you want to implement and why it is
> not possible?

This pseudo-code is no more possible:

  if upgrade-requested-for(req) then
     handler = create-websocket-for(req)
     if handler created then
          reply "switch protocol"
     else
          reply "internal error"
     end
  else
     ....
  end

Instead you may write:

  if upgrade-requested-for(req) then
     reply "switch protocol" with callback
  else
     ....
  end

and in the callback

  handler = create-websocket-for(req)
  if handler created then
      cool
  else
      not cool, too late for sending an internal error
  end

But as written there is something not cool cool
So the following version is dandling with the hole

  if upgrade-requested-for(req) then
     handler = create-websocket-lazy
     if handler created then
          reply "switch protocol" with callback
     else
          reply "internal error"
     end
  else
     ....
  end

and in the callback

  attach-websocket-socket(...)

> 
> >> Third, do you plan to provide a new version soon?  
> 
> Yes, watch this list. :)
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]