Example #1
0
def add_wsx_subscription(session, cluster_id, is_internal, sub_key, ext_client_id, ws_channel_id, sub_id):
    """ Adds an object representing a subscription of a WebSockets client.
    """
    wsx_sub = WebSocketSubscription()
    wsx_sub.is_internal = is_internal or False
    wsx_sub.sub_key = sub_key
    wsx_sub.ext_client_id = ext_client_id
    wsx_sub.channel_id = ws_channel_id
    wsx_sub.cluster_id = cluster_id
    wsx_sub.subscription_id = sub_id
    session.add(wsx_sub)

    return wsx_sub
Example #2
0
    def handle(self):
        req = self.request.input

        with closing(self.odb.session()) as session:

            sub = WebSocketSubscription()
            sub.is_internal = req.is_internal
            sub.pattern = req.pattern
            sub.is_by_ext_id = req.is_by_ext_id
            sub.is_by_channel = req.is_by_channel
            sub.is_durable = req.is_durable
            sub.has_gd = req.has_gd
            sub.client_id = req.client_id
            sub.channel_id = req.channel_id
            sub.server_id = self.server.id

            session.add(sub)
            session.commit()