这是indexloc提供的服务,不要输入任何密码
Skip to content

Will calls on ServerSocket::request returned MainLoop::new_client applies Tower layers? #11

@alissa-tung

Description

@alissa-tung

Thank you for developing this library, and

Hello, I had tried two ways creating Tower layers to make some logs:

  • the first approach is to simple create a Tower layer, logging on trait methods fn notify, fn emit and fn call
  • the second approach is enable the forward feature, mock the server and client like what examples/interceptor.rs do, logging on trait methods fn notify, fn emit and fn call

both approach applies logs for requests from server to client, but does not work for the requests that I filed from client with ServerSocket::request, where the ServerSocket instance is returned by MainLoop::new_client.

My questions are:

  • will calls on ServerSocket::request returned MainLoop::new_client applies Tower layers?
  • did I miss something or some methods when logging on trait methods fn notify, fn emit and fn call
  • what is the event in the library?

I had also tried to use the builder function MainLoop::new_client's server socket argument, use router.request::<ACustomRequest>(|router_state, request| { logging here; return here }). but

  • I do not know that does the parameter server socket of the MainLoop::new_client do
  • the logging seems in the .request::<MainLoop::new_client>(....) does not work, the callback is not fired
  • in the .request::<MainLoop::new_client>(....) callback, calling the .request of server_socket yields the Result<_, async_lsp:Error>, but not the Result<_, async_lsp:ResponseError> which is required by the router.request callback

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions