add #:tcp@ to ws-serve for wss: support
This commit is contained in:
parent
b686cc84a9
commit
11f2653b7e
|
@ -6,6 +6,7 @@
|
|||
web-server/http
|
||||
racket/list
|
||||
racket/async-channel
|
||||
(prefix-in raw: (for-label net/tcp-unit))
|
||||
net/websocket
|
||||
net/websocket/client
|
||||
net/websocket/server
|
||||
|
@ -46,6 +47,7 @@ This module also provides the exports from @racketmodname[net/websocket/conn].
|
|||
conn-headers
|
||||
(bytes? (listof header?) . -> . (values (listof header?) any/c))
|
||||
(λ (b hs) (values empty (void)))]
|
||||
[#:tcp@ tcp@ (unit/c (import) (export tcp^)) raw:tcp@]
|
||||
[#:port port tcp-listen-port? 80]
|
||||
[#:listen-ip listen-ip (or/c string? false/c) #f]
|
||||
[#:max-waiting max-waiting integer? 4]
|
||||
|
@ -64,6 +66,7 @@ This module also provides the exports from @racketmodname[net/websocket/conn].
|
|||
|
||||
All other arguments are used as in a @secref["dispatch-server-unit" #:doc '(lib "web-server/scribblings/web-server-internal.scrbl")].
|
||||
|
||||
The @racket[#:tcp@] keyword is provided for building an SSL server.
|
||||
}
|
||||
|
||||
This module also provides the exports from @racketmodname[net/websocket/conn].
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
web-server/http/request-structs
|
||||
racket/async-channel
|
||||
unstable/contract
|
||||
net/tcp-sig
|
||||
(prefix-in raw: net/tcp-unit)
|
||||
net/websocket/conn
|
||||
net/websocket/handshake)
|
||||
(provide (except-out (all-from-out net/websocket/conn) ws-conn))
|
||||
|
@ -16,6 +18,8 @@
|
|||
(->* ((open-ws-conn? any/c . -> . void))
|
||||
(#:conn-headers
|
||||
(bytes? (listof header?) . -> . (values (listof header?) any/c))
|
||||
#:tcp@
|
||||
(unit/c (import) (export tcp^))
|
||||
#:port
|
||||
tcp-listen-port?
|
||||
#:listen-ip
|
||||
|
@ -30,6 +34,7 @@
|
|||
|
||||
(define (ws-serve conn-dispatch
|
||||
#:conn-headers [pre-conn-dispatch (λ (cline hs) (values empty (void)))]
|
||||
#:tcp@ [tcp@ raw:tcp@]
|
||||
#:port [port 80]
|
||||
#:listen-ip [listen-ip #f]
|
||||
#:max-waiting [max-waiting 4]
|
||||
|
@ -71,5 +76,14 @@
|
|||
|
||||
(conn-dispatch conn state))
|
||||
|
||||
(define-values/invoke-unit/infer dispatch-server@)
|
||||
(define-unit-binding a-tcp@
|
||||
tcp@ (import) (export tcp^))
|
||||
(define-compound-unit/infer dispatch-server@/tcp@
|
||||
(import dispatch-server-config^)
|
||||
(link a-tcp@ dispatch-server@)
|
||||
(export dispatch-server^))
|
||||
(define-values/invoke-unit
|
||||
dispatch-server@/tcp@
|
||||
(import dispatch-server-config^)
|
||||
(export dispatch-server^))
|
||||
(serve #:confirmation-channel confirm-ch))
|
Loading…
Reference in New Issue
Block a user