Hi list. On Tue, Feb 2, 2016 at 8:38 PM, Bram Moolenaar <[email protected]> wrote: > > Yasuhiro Matsumoto wrote: > >> > > connect() doesn't have timeout. So when server is down, connect() >> > > hangs while 1 or 2 minuts. Below is a patch to add timeout query like >> > > URL. >> > > >> > > connect("localhost:12345?timeout=3") >> > > >> > > https://gist.github.com/mattn/867a635e14ac2360613a >> > > >> > > But I'm thinking there is another ways to specify {timeout} like below. >> > > >> > > >> > > connect("localhost:12345", {"type": "raw", "timeout": 3}) >> > > >> > > How do you think? >> > >> > Thanks. Yes, we need to be able to specify a timeout. Both for making >> > the connection and for waiting for a response. >> > >> > Since the number of options is likely to increase, using a dict instead >> > of positional arguments is appropriate. We do need default values: >> > >> > mode default "json" >> > callback default: none >> > waittime default: zero (waiting for the server) >> > timeout default: 1 second (waiting for response) >> > >> > Something like that. Could also use a separate call to set the response >> > timeout, like there is a way to set the callback with sethandler(). >> > We could end up with lots of functions though. perhaps a channelconfig() >> > function with a dict argument is better. >> > >> > I think we should normally assume that the server is already running. >> > This allows for using a connect() call to check for that, and allow for >> > starting the server if it fails. >> > >> > let handle = connect("localhost:1234") >> > if handle < 0 >> > call StartServer() >> > let handle = connect("localhost:1234" {"waittime": 3}) >> > endif >> >> Well, when the {callback} is specified in the dict and 3rd argument >> either, which is used? >> >> connect("localhost:12345", "json", "Callback") >> connect("localhost:12345", {"mode": "json", "callback": "Callback"}, >> "AnotherCallback") > > There won't be a third argument. > > I'm also wondering if we should have all the functions start with > "channel". With connect(), disconnect(), sethandler(), etc. they will be > all over the place and hard to find. How about this: > > channelopen() > channelclose() > channelcallback() > channeltimeout() > channelsendexpr() > channelsendraw() > > We probably need a few more later. > > The names are a bit long and not easy to read, perhaps we can use a ch_ > prefix: > > ch_open() > ch_close() > ch_callback() > ch_timeout() > ch_sendexpr() > ch_sendraw() I think a prefix is needed. Because a user can easily find out what operation for and easily find those helps (':help ch*()<Tab>' will shows channel functions). Though, I don't know which is apporopriate one.
> > -- > To be rich is not the end, but only a change of worries. > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org /// > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
