mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
p2p: Use JSServer for comms rather than GoJsConn (#888)
* p2p: Use JSServer for comms rather than GoJsConn This has several benefits: - it fixes a bug whereby you could not transmit >4k bytes to/from JS/Go land. - it more clearly exposes the interface point between Go and JS: a single global function call. - it presents a nicer API shape than the previous `net.Conn`. - it doesn't needlessly 'stream' data which is already sitting in-memory. This is currently only active for local CS API traffic, another PR will add Federation P2P support. * Typo
This commit is contained in:
parent
d71b72816d
commit
8bc5084d8d
5 changed files with 118 additions and 15 deletions
|
@ -156,10 +156,10 @@ func main() {
|
|||
// Expose the matrix APIs via fetch - for local traffic
|
||||
go func() {
|
||||
logrus.Info("Listening for service-worker fetch traffic")
|
||||
|
||||
listener := go_http_js_libp2p.NewFetchListener()
|
||||
s := &http.Server{}
|
||||
go s.Serve(listener)
|
||||
s := JSServer{
|
||||
Mux: http.DefaultServeMux,
|
||||
}
|
||||
s.ListenAndServe("fetch")
|
||||
}()
|
||||
|
||||
// We want to block forever to let the fetch and libp2p handler serve the APIs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue