Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix websocket conflict, update deprecated Fmt functions #206

Merged
merged 3 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graphql-async/test/async_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let test_query schema ctx query expected =
| Ok (`Stream stream) ->
Async_kernel.Pipe.to_list stream >>| fun lst ->
`List
Core_kernel.(
Core.(
List.map lst ~f:(fun x -> Option.value_exn (Result.ok x)))
| Error err -> Async_kernel.return err)
>>| fun result ->
Expand Down
2 changes: 1 addition & 1 deletion graphql-cohttp/src/graphql_cohttp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ module Make
(Io : Cohttp.S.IO with type 'a t = 'a Schema.Io.t)
(Body : HttpBody with type +'a io := 'a Schema.Io.t) =
struct
module Ws = Websocket.Connection.Make (Io)
module Ws = Graphql_websocket.Connection.Make (Io)
module Websocket_transport = Websocket_handler.Make (Schema.Io) (Ws)

let ( >>= ) = Io.( >>= )
Expand Down
12 changes: 6 additions & 6 deletions graphql-cohttp/src/websocket_handler.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Make
(IO : Graphql_intf.IO)
(Ws : Websocket.Connection.S with type 'a IO.t = 'a IO.t) =
(Ws : Graphql_websocket.Connection.S with type 'a IO.t = 'a IO.t) =
struct
module Json = Yojson.Basic.Util

Expand Down Expand Up @@ -61,7 +61,7 @@ struct

(* | Gql_connection_keep_alive -> "ka" *)

let create_message ?(opcode = Websocket.Frame.Opcode.Text) ?id
let create_message ?(opcode = Graphql_websocket.Frame.Opcode.Text) ?id
?(payload = `Null) typ =
let frame_payload =
`Assoc
Expand All @@ -72,13 +72,13 @@ struct
]
in
let content = Yojson.Basic.to_string frame_payload in
Websocket.Frame.create ~opcode ~content ()
Graphql_websocket.Frame.create ~opcode ~content ()

let handle_frame t ~execute_query frame =
match frame.Websocket.Frame.opcode with
match frame.Graphql_websocket.Frame.opcode with
| Ping | Pong | Close | Ctrl _ | Nonctrl _ -> IO.return ()
| Continuation | Text | Binary -> (
let json = Yojson.Basic.from_string frame.Websocket.Frame.content in
let json = Yojson.Basic.from_string frame.Graphql_websocket.Frame.content in
match client_message_of_payload json with
| Ok Gql_connection_init ->
Ws.send t.conn (create_message Gql_connection_ack)
Expand Down Expand Up @@ -106,7 +106,7 @@ struct
| Ok Gql_connection_terminate ->
Hashtbl.iter (fun _id close -> close ()) t.subscriptions;
Ws.send t.conn
(create_message ~opcode:Websocket.Frame.Opcode.Close
(create_message ~opcode:Graphql_websocket.Frame.Opcode.Close
Gql_connection_error)
| Error msg ->
let id = Json.(json |> member "id" |> to_string) in
Expand Down
2 changes: 1 addition & 1 deletion graphql_parser/src/ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ module Pp = struct

and selection_set fmt =
omit_empty_list
Fmt.(braces (hvbox ~indent:2 (prefix cut (list pp_selection))))
Fmt.(braces (hvbox ~indent:2 (cut ++ (list pp_selection))))
fmt

let rec pp_typ fmt = function
Expand Down