Skip to content

🧪 Phoenix Socket - overwrite default implementation in order to use async code in e.g. params setter

License

Notifications You must be signed in to change notification settings

TheWidlarzGroup/async-params-phoenix-socket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Async params wrapper for Phoenix Socket

If you are using the Phoenix and Absinthe library in your JS codebase to instantiate the graphql websocket connection, you may stumble across the problem of setting the params with a function returning a Promise. To resolve the problem, you can use these socket.ts/socket.js files.

The rest of the setup should go like this

Instead of importing

import { Socket as PhoenixSocket } from "phoenix";

just import your custom implementation from socket.ts / socket.js:

import PhoenixSocket from "../path/socket";

and you should be done 😀

Happy coding 🔥

About

🧪 Phoenix Socket - overwrite default implementation in order to use async code in e.g. params setter

Resources

License

Stars

Watchers

Forks