...

Text file src/github.com/gorilla/websocket/examples/command/README.md

Documentation: github.com/gorilla/websocket/examples/command

     1# Command example
     2
     3This example connects a websocket connection to stdin and stdout of a command.
     4Received messages are written to stdin followed by a `\n`. Each line read from
     5standard out is sent as a message to the client.
     6
     7    $ go get github.com/gorilla/websocket
     8    $ cd `go list -f '{{.Dir}}' github.com/gorilla/websocket/examples/command`
     9    $ go run main.go <command and arguments to run>
    10    # Open http://localhost:8080/ .
    11
    12Try the following commands.
    13
    14    # Echo sent messages to the output area.
    15    $ go run main.go cat
    16
    17    # Run a shell.Try sending "ls" and "cat main.go".
    18    $ go run main.go sh
    19

View as plain text