seven
seven
TtRPC
Created by seven on 8/21/2024 in #❓-help
Is it ok to have 2 clients in one app
super, thank you!
4 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
thank you!
12 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
hmmm no it was because od lazy flag was on now its working and im gettingconsole logs 😄
12 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
this does not work
op.type === 'subscription' || op.path === 'binance.ordersStream'
op.type === 'subscription' || op.path === 'binance.ordersStream'
i get waring in the console saying that
wsLink.mjs:120 WebSocket connection to 'ws://localhost:7000/' failed: WebSocket is closed before the connection is established.
wsLink.mjs:120 WebSocket connection to 'ws://localhost:7000/' failed: WebSocket is closed before the connection is established.
12 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
if i understand correectly you say that i could configure in my trpc client that if i use certain procedure (i want this ws link to work only on placeOrder mutation procedure) than instead od http link ws link would be used and the connection to my procedure would stau open and the data would be transmitted super fast?
links: [
splitLink({
condition: (op) => op.type === 'subscription || procedure name is placeOrder',
true: wsLink({
client: createWSClient({
url: `ws://localhost:7000`,
lazy: {
enabled: true,
closeMs: 10000000000000000000000,
},
}),
transformer: superjson,
}),
false: httpLink({
url: `http://localhost:7000`,
fetch(url, options) {
return fetch(url, {
...options,
credentials: 'include',
cache: 'no-store',
});
},
transformer: superjson,
}),
}),
],
links: [
splitLink({
condition: (op) => op.type === 'subscription || procedure name is placeOrder',
true: wsLink({
client: createWSClient({
url: `ws://localhost:7000`,
lazy: {
enabled: true,
closeMs: 10000000000000000000000,
},
}),
transformer: superjson,
}),
false: httpLink({
url: `http://localhost:7000`,
fetch(url, options) {
return fetch(url, {
...options,
credentials: 'include',
cache: 'no-store',
});
},
transformer: superjson,
}),
}),
],
12 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
and many thanks for replying this i important to me
12 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
could you please give me some code example how thiscould look like? i don't understand how it should be done 🙂
12 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
how does it realte to sending messages via ws to my subscription procedure?
12 replies
TtRPC
Created by seven on 7/7/2024 in #❓-help
client server counication with webSockets
Hi @BeBoRE what do you mean by that wsLink supports mutations? and what does it mean that is is lazy? you can evable it in config but the doc says that
Lazy mode will close the WebSocket automatically after a period of inactivity (no messages sent or received and no pending requests)
Lazy mode will close the WebSocket automatically after a period of inactivity (no messages sent or received and no pending requests)
12 replies
TtRPC
Created by seven on 4/5/2024 in #❓-help
Cookie authentication flow
Hi i would like to answer my question, the problem was that i did not pass credentials: include to the fetch options, currenty i use experimental_createTRPCNextAppDirClient with experimental_nextHttpLink, this does not allow to pass options to fetch, would you consider adding this option in future release? thanks
4 replies