This is an outdated version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__version__ = "0.1-prealpha" | |
__author__ = "Adam Hopkins" | |
import trio | |
from itertools import count | |
from functools import partial | |
from functools import lru_cache | |
from collections import defaultdict | |
from typing import Optional, List |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from datetime import datetime | |
from jwt.exceptions import DecodeError | |
from sanic import Sanic | |
from sanic.response import json | |
from sanic_jwt import ( | |
Authentication, | |
Claim, | |
Configuration, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import TextField from '@ember/component/text-field' | |
export default TextField.extend({ | |
focusIn: function (event) { | |
this.$().select() | |
} | |
}); |
The purpose of this gist is to show how Sanic can be used as a development server for a frontend JS framework. In this example we are running a Svelte app with rollup
, but the same idea could be applied to any other frameworks JS build tools.
Run with:
sanic path.to:app -d -R ./path/to/public
This is an example of how to build a distributed websocket feed. It allows for horizontal scaling using Redis as a pubsub broker to broadcast messages between application instances.
This is the third version of websocket feeds. It is built with Sanic v21.9+ in mind. Older versions: