Interpret \n as Enter (will need to adjust for Winshit)
This commit is contained in:
parent
608d780db1
commit
718bba4702
16
Streaming.md
16
Streaming.md
@ -31,7 +31,7 @@ func clientConnected(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
c.WriteMessage(websocket.TextMessage, []byte("authenticated"))
|
c.WriteMessage(websocket.TextMessage, []byte("authenticated"))
|
||||||
|
|
||||||
|
var parts []string
|
||||||
for {
|
for {
|
||||||
time.Sleep(25 * time.Millisecond)
|
time.Sleep(25 * time.Millisecond)
|
||||||
_, message, err := c.ReadMessage()
|
_, message, err := c.ReadMessage()
|
||||||
@ -44,9 +44,17 @@ func clientConnected(w http.ResponseWriter, r *http.Request) {
|
|||||||
if message_string == "" {
|
if message_string == "" {
|
||||||
message_string = "\n"
|
message_string = "\n"
|
||||||
}
|
}
|
||||||
err = keyboard.Type(message_string)
|
|
||||||
if err != nil {
|
parts = strings.Split(message_string, "\n")
|
||||||
log.Println("type:", err)
|
|
||||||
|
for _, part := range parts {
|
||||||
|
err = keyboard.Type(part)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("type:", err)
|
||||||
|
}
|
||||||
|
if len(parts) > 1 {
|
||||||
|
keyboard.Enter()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user