gsoutz
gsoutz
SSolidJS
Created by gsoutz on 10/5/2024 in #support
Invalid Frame Header only on production build websockets
Guys, I've found the problem, export async function GET(event: APIEvent) { let request = event.nativeEvent.node.req let { path } = event.params await handleUpgrade(request) return undefined } this Route API is returning something to the client even though I handle the upgrade myself. So if I put a delay before this function returns the Invalid Frame Header error is delayed. So my question is, how do I make a Router API not to return anything or do anything weird, because I am handling the upgrade myself.
3 replies
SSolidJS
Created by gsoutz on 10/5/2024 in #support
Invalid Frame Header only on production build websockets
I think I have found the problem. Sorry just getting used to this SSR thing. Probably I need to tell that WebSocket client is clientSide only code. I seen some documentation where functions are named clientOnlySocketProvider, like that. I will try that tomorrow. If any of you have a further suggestion feel free to let me know.
3 replies
SSolidJS
Created by gsoutz on 10/5/2024 in #support
cache doesnt revalidate inside websocket on('message')
by instrumenting a refetch.
4 replies
SSolidJS
Created by gsoutz on 10/5/2024 in #support
cache doesnt revalidate inside websocket on('message')
Ok I think I figured out what cache is doing. It's a client side only feature, to keep the browser updated with changes. On the server side, I don't use cache.
4 replies
SSolidJS
Created by gsoutz on 10/5/2024 in #support
cache doesnt revalidate inside websocket on('message')
I changed it to this, and still doesn't update
await make_game_move({ id: this.game_id, board, status, sans })

await revalidate([getGame.keyFor(this.game_id), getPov.keyFor(this.game_id, this.user.id)])

let asdf = await getGame(this.game_id)
console.log(getGame.keyFor(this.game_id), ' after revalidate', this.game_id, 'sans', asdf!.sans)
console.log(getPov.keyFor(this.game_id, this.user.id))
await make_game_move({ id: this.game_id, board, status, sans })

await revalidate([getGame.keyFor(this.game_id), getPov.keyFor(this.game_id, this.user.id)])

let asdf = await getGame(this.game_id)
console.log(getGame.keyFor(this.game_id), ' after revalidate', this.game_id, 'sans', asdf!.sans)
console.log(getPov.keyFor(this.game_id, this.user.id))
4 replies
SSolidJS
Created by gsoutz on 10/4/2024 in #support
"use server" doesn't work if put at the top of the file
so cache wrapper is not just an optimization but a necessity to achieve reactivity. I will just leave the use server inside functions as before and move on. Does that sound ok my understanding?
5 replies
SSolidJS
Created by gsoutz on 10/3/2024 in #support
How do I do something after a redirect, like reload the page, or in this case reconnect a websocket?
omg that worked thanks.
10 replies
SSolidJS
Created by gsoutz on 10/3/2024 in #support
How do I do something after a redirect, like reload the page, or in this case reconnect a websocket?
useParams doesn't react to changes, I've also used a custom signal and tried to change that and it gave error, set_a is not defined.
export default function Home() {
const params = useParams()

let [a, set_a] = createSignal(1)
let { send, page, cleanup } = useContext(SocketContext)!
onMount(() => {
page('site')
})

let profile = createAsync(() => getProfile(params.username))
let user = createAsync(() => getUser())
createEffect(() => {
console.log(a())
})

let action_reset_profile = useAction(action(async() => {
"use server"
let user = await resetUser()

let res = redirect(`/u/${user.username}`, { revalidate: ['get_user']})

set_a(3)
return res
}))
export default function Home() {
const params = useParams()

let [a, set_a] = createSignal(1)
let { send, page, cleanup } = useContext(SocketContext)!
onMount(() => {
page('site')
})

let profile = createAsync(() => getProfile(params.username))
let user = createAsync(() => getUser())
createEffect(() => {
console.log(a())
})

let action_reset_profile = useAction(action(async() => {
"use server"
let user = await resetUser()

let res = redirect(`/u/${user.username}`, { revalidate: ['get_user']})

set_a(3)
return res
}))
10 replies
SSolidJS
Created by gsoutz on 10/3/2024 in #support
How do I do something after a redirect, like reload the page, or in this case reconnect a websocket?
let action_reset_profile = useAction(action(async() => {
"use server"
let user = await resetUser()

return redirect(`/u/${user.username}`, { revalidate: ['get_user']})
}))
let action_reset_profile = useAction(action(async() => {
"use server"
let user = await resetUser()

return redirect(`/u/${user.username}`, { revalidate: ['get_user']})
}))
10 replies
SSolidJS
Created by gsoutz on 10/3/2024 in #support
How do I do something after a redirect, like reload the page, or in this case reconnect a websocket?
I have this dynamic route u/:username The action changes the username invalidates the user and redirects to u/hello to u/world , and I can't get any notification on anywhere. Except onBeforeLeave occurs but I get the old username 'hello'. I need a callback after the cache invalidates, so I can reconnect the websocket.
10 replies
SSolidJS
Created by gsoutz on 10/3/2024 in #support
Should I destroy and create a new websocket connection on each page?
thank you, i will work on that.
3 replies
SSolidJS
Created by gsoutz on 10/3/2024 in #support
How to crossws websocket Resolver API access getSession?
So what is the purpose of a message handler then?
3 replies
SSolidJS
Created by gsoutz on 10/3/2024 in #support
How to crossws websocket Resolver API access getSession?
In fact, I honestly don't understand how this handler works, I thought async resolve(req), method is only called once when the websocket connection is established, but it is called everytime a message is exchanged?
3 replies
SSolidJS
Created by gsoutz on 10/2/2024 in #support
__vite-browser-external:node:async_hooks:3 Uncaught Error: Module "node:async_hooks" has been extern
I think I solved it by putting "use server" inside getSession I didn't know every nested function call has to have that even though outer functions have it already.
2 replies
SSolidJS
Created by gsoutz on 10/2/2024 in #support
What is wrong with Math.random create Signal
One more thing, I have this for creating a session password:
const password = process.env.SESSION_SECRET ??
Math.random().toString(16).slice(2) +
Math.random().toString(16).slice(2) +
Math.random().toString(16).slice(2) +
Math.random().toString(16).slice(2)
const password = process.env.SESSION_SECRET ??
Math.random().toString(16).slice(2) +
Math.random().toString(16).slice(2) +
Math.random().toString(16).slice(2) +
Math.random().toString(16).slice(2)
Where should I put this so it is set once the server starts and never changes on every request, because when I put this at the top level of app.tsx, it changes with every request.
8 replies
SSolidJS
Created by gsoutz on 10/2/2024 in #support
What is wrong with Math.random create Signal
thanks for the very detailed answer.
8 replies
SSolidJS
Created by gsoutz on 10/2/2024 in #support
What is wrong with Math.random create Signal
I see isServer and isClient executes twice, but what is the best way to fix this?
8 replies
SSolidJS
Created by Massukka on 9/29/2024 in #support
Is it possible to show <Errorboundary> as toast/pop up?
You can just have the error boundary inside your main layout, so main layout always renders.
7 replies
SSolidJS
Created by gsoutz on 7/19/2024 in #support
Cant set signal from getting another signal typescript error
why can't i just do as i tried above.
7 replies