https://github.com/godcong/cor
https://github.com/godcong/cor
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/godcong/cor
- Owner: godcong
- License: mit
- Created: 2017-06-09T02:29:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-22T02:55:40.000Z (over 8 years ago)
- Last Synced: 2025-01-26T08:11:32.224Z (11 months ago)
- Language: Go
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cor
write the server code as:
corlog.LogToFile("server")
serv := cor.NewServer()
//serv.Head().SetRW(true)
serv.WriteCallback(func(h cor.Header) (interface{}, error) {
T := cor.Test{
"congcong",
1,
2,
3,
}
return T, nil
})
serv.ReadCallback(func(h cor.Header, v interface{}) error {
log.Println("reader", h, v)
return nil
})
serv.Start()
write the client code as:
cli := cor.NewClient()
//cli.Head().SetRW(true)
cli.WriteCallback(func(h cor.Header) (interface{}, error) {
return t{"cong", 1}, nil
})
cli.ReadCallback(func(h cor.Header, v interface{}) error {
log.Println(v)
return nil
})
cli.Start()