<commit_before>package main

import (
	"flag"
	"fmt"
	"log"
	"net/url"
	"os"
	"os/signal"
	"strings"
	"time"

	"github.com/gorilla/websocket"
)

var addr = flag.String("addr", "172.16.58.3:8081", "http service address")

var (
	MESSAGE_CHAT = "LHTTP/1.0 chat\r\ncontent-type:json\r\ncontent-length:10\r\n\r\njsonbody"
	MESSAGE_SUB  = "LHTTP/1.0 subpub\r\nsubscribe:channel_mike\r\n\r\n"
	MESSAGE_PUB  = "LHTTP/1.0 subpub\r\npublish:channel_mike\r\n\r\nhello mike, I am jack"
)

func sendSubscribe(c *websocket.Conn) {
	/*
		fmt.Println("input your channels split by blank:")
		in := make([]byte, 1024)
		os.Stdin.Read(in)
	*/
	msg := "LHTTP/1.0 suubpub\r\nsubscribe:cam_123" + "\r\n\r\n"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}
func sendUnsubscribe(c *websocket.Conn) {
	/*
		fmt.Println("input your channels split by blank:")
		in := make([]byte, 1024)
		os.Stdin.Read(in)
	*/
	msg := "LHTTP/1.0 suubpub\r\nunsubscribe:camera_123" + "\r\n\r\n"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}
func sendPublish(c *websocket.Conn) {
	/*
		fmt.Println("input your channels split by blank:")
		in := make([]byte, 1024)
		os.Stdin.Read(in)
	*/
	msg := "LHTTP/1.0 suubpub\r\npublish:camera_123" + "\r\n\r\nhello world"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}

func sendUpstream(c *websocket.Conn) {
	msg := "LHTTP/1.0 upstream\r\nupstream:GET http://172.16.58.3:8080/v1/user/10000/reports?AlgID=1\r\n\r\n"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
	msg = "LHTTP/1.0 upstream\r\nupstream:POST http://172.16.58.3:8080/v1/camera/10000/alarms\r\n\r\n{}"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}

func sendMultipart(c *websocket.Conn) {
	msg := "LHTTP/1.0 upload\r\nmultipart:0 14\r\n\r\nk1:v1\r\n\r\nbody1k2:v2\r\n\r\nbody2"
	c.WriteMessage(websocket.TextMessage, []byte(msg))<commit_msg>fiexd sample error<commit_after>package main

import (
	"flag"
	"fmt"
	"log"
	"net/url"
	"os"
	"os/signal"
	"strings"
	"time"

	"github.com/gorilla/websocket"
)

var addr = flag.String("addr", "172.16.58.3:8081", "http service address")

var (
	MESSAGE_CHAT = "LHTTP/1.0 chat\r\ncontent-type:json\r\ncontent-length:10\r\n\r\njsonbody"
	MESSAGE_SUB  = "LHTTP/1.0 subpub\r\nsubscribe:channel_mike\r\n\r\n"
	MESSAGE_PUB  = "LHTTP/1.0 subpub\r\npublish:channel_mike\r\n\r\nhello mike, I am jack"
)

func sendSubscribe(c *websocket.Conn) {
	/*
		fmt.Println("input your channels split by blank:")
		in := make([]byte, 1024)
		os.Stdin.Read(in)
	*/
	msg := "LHTTP/1.0 subpub\r\nsubscribe:camera_123" + "\r\n\r\n"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}
func sendUnsubscribe(c *websocket.Conn) {
	/*
		fmt.Println("input your channels split by blank:")
		in := make([]byte, 1024)
		os.Stdin.Read(in)
	*/
	msg := "LHTTP/1.0 subpub\r\nunsubscribe:camera_123" + "\r\n\r\n"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}
func sendPublish(c *websocket.Conn) {
	/*
		fmt.Println("input your channels split by blank:")
		in := make([]byte, 1024)
		os.Stdin.Read(in)
	*/
	msg := "LHTTP/1.0 subpub\r\npublish:camera_123" + "\r\n\r\nhello world"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}

func sendUpstream(c *websocket.Conn) {
	msg := "LHTTP/1.0 upstream\r\nupstream:GET http://172.16.58.3:8080/v1/user/10000/reports?AlgID=1\r\n\r\n"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
	msg = "LHTTP/1.0 upstream\r\nupstream:POST http://172.16.58.3:8080/v1/camera/10000/alarms\r\n\r\n{}"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
}

func sendMultipart(c *websocket.Conn) {
	msg := "LHTTP/1.0 upload\r\nmultipart:0 14\r\n\r\nk1:v1\r\n\r\nbody1k2:v2\r\n\r\nbody2"
	c.WriteMessage(websocket.TextMessage, []byte(msg))
{'fraction_non_alphanumeric': 0.19374149659863946, 'fraction_numerical': 0.053877551020408164, 'mean_word_length': 4.2439372325249645, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4899461', 'n_tokens_mistral': 1780, 'n_tokens_neox': 1631, 'n_words': 231}