Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom JSON Encoder not used for client-side callbacks #297

Closed
skortchmark9 opened this issue Aug 2, 2016 · 2 comments
Closed

Custom JSON Encoder not used for client-side callbacks #297

skortchmark9 opened this issue Aug 2, 2016 · 2 comments
Assignees
Labels

Comments

@skortchmark9
Copy link

Hey Miguel, thank you so much for all the work you put into this library. I am using a custom JSON encoder to encode sqlalchemy objects.

from server.models.custom_encoder import JSONEncoder 
app.json_encoder = JSONEncoder
socketio.init_app(app, json=flask.json)

@socketio.on("evt")
def test_ack():
    return Model.query.all()  # Dies, and printlines in my custom encoder don't fire.

@socketio.on("evt")
def test_emit():
    emit("response", Model.query.all())  # works, encoder is being used.

Please let me know if you have any ideas - for now I am just doing

return flask.json.dumps(Model.query.all())
@miguelgrinberg
Copy link
Owner

Let me know if v2.6.2 addresses this issue for you, or if there are still problems. Thanks!

@skortchmark9
Copy link
Author

Yes fixed. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants