On Mon, 28 Nov 2016 11:50:26 +0300
Konstantin Khomoutov <flatw...@users.sourceforge.net> wrote:

[...]
> > I do have my go handler configured, as well as my ws function in
> > javascript configured to be triggered on the click of a button.
> > Forgot to mention this. right now on the click of a button I can
> > execute a terminal command in go, and output the results in realtime
> > on my webpage. But what I want to do is configure a toggle switch on
> > my webpage so that if the switch is in an on position, then when I
> > click the button, I can execute a terminal command in my go code,
> > and if the switch is off, after I click the button my go code will
> > execute a different terminal command. Here is the toggle switch I
> > have implemented: http://www.bootstraptoggle.com/
> > 
> > But now I'm stuck on how to read whether this switch is in its
> > off/on position in my go code. Any suggestions would help.
> 
> In general, you can't do this (well, almost [*]).

Forgot to address this point.

Well, with modern browsers and websockets it should be possible to use
the so-called "server sent events" which allows the server to actively
solitict an action from the client.

But the fact this feature exists does not means it should be used in
your case.  Your case, in my opinion, is much simpler and I suggest you
to not overengeneer your solution.

[...]

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to