Hi Pact, We are trying to develop a plugin in rus...
# general
a
Hi Pact, We are trying to develop a plugin in rust that enables support WebSockets. Unfortunately it doesn’t look like the example plugins start up a new server so I am struggling a bit. The
start_mock_server
function on the Plugin trait does not have a mutable reference to the Plugin struct and so I can’t store a reference to the server. Is there some guidance I can get on how to implement this properly?
👋 1
Or are we expected to run the Mock Server as a separate process entirely?
u
Hi Adam, you can have a look at the gRPC plugin, it provides a gRPC mock server. See https://github.com/pactflow/pact-protobuf-plugin/blob/main/src/server.rs#L568
It stores the data for the running mock server in a global variable using the lazy_static crate. See https://github.com/pactflow/pact-protobuf-plugin/blob/main/src/mock_server.rs#L49
a
Thank you! I have been looking at the protobuf plugin in pact-plugins/plugins but it is in Kotlin and I was having a hard time reading it and working our how it could apply to our rust version. This is excellent. Much appreciated. I’ll take a look and see how I can apply this to our own code
m
Awesome stuff Adam! Do join the #C047TCR7B6W channel if you haven’t already, and if the time is right we can create a #websockets channel for this.
Let us know how we can best support you
a
Hi @Matt (pactflow.io / pact-js / pact-go) - I have just posted our next hurdle over in the #C047TCR7B6W channel. Something is not quite working but we are struggling to work out whats going on
👍 1