文件名称:GolangHTTP的longpolling库Golongpoll.zip
文件大小:65KB
文件格式:ZIP
更新时间:2022-08-07 20:04:44
开源项目
Golongpoll 是 golang HTTP 的 longpolling 库,可以使构建 web pub-sub 更加容易。基本用法:import "github.com/jcuga/golongpoll" // This launches a goroutine and creates channels for all the plumbing manager, err := golongpoll.CreateManager() // Expose events to browsers // See subsection on how to interact with the subscription handler http.HandleFunc("/events", manager.SubscriptionHandler) http.ListenAndServe("127.0.0.1:8081", nil) // Pass the manager around or create closures and publish: manager.Publish("subscription-category", "Some data. Can be string or any obj convertable to JSON") manager.Publish("different-category", "More data") 标签:Golongpoll
【文件预览】:
golongpoll-master
----.travis.yml(366B)
----utils_test.go(2KB)
----longpoll_deprecated.go(1KB)
----longpoll.go(27KB)
----LICENSE(1KB)
----longpoll_test.go(62KB)
----go-client()
--------glpclient()
----priority_queue.go(2KB)
----events_test.go(18KB)
----examples()
--------advanced()
--------basic()
----.gitignore(280B)
----events.go(6KB)
----readme-images()
--------longpoll.png(6KB)
--------longpoll-timeout.png(7KB)
--------polling.png(7KB)
----README.md(13KB)
----utils.go(1006B)
----.gitattributes(13B)
----priority_queue_test.go(5KB)