• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hivesolutions / pushi / 313

pending completion
313

push

travis-ci-com

joamag
feat: dashed based dependencies

654 of 1694 relevant lines covered (38.61%)

1.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.17
/src/pushi/app/controllers/socket.py
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3

4
# Hive Pushi System
5
# Copyright (c) 2008-2020 Hive Solutions Lda.
6
#
7
# This file is part of Hive Pushi System.
8
#
9
# Hive Pushi System is free software: you can redistribute it and/or modify
10
# it under the terms of the Apache License as published by the Apache
11
# Foundation, either version 2.0 of the License, or (at your option) any
12
# later version.
13
#
14
# Hive Pushi System is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# Apache License for more details.
18
#
19
# You should have received a copy of the Apache License along with
20
# Hive Pushi System. If not, see <http://www.apache.org/licenses/>.
21

22
__author__ = "João Magalhães <joamag@hive.pt>"
5✔
23
""" The author(s) of the module """
24

25
__version__ = "1.0.0"
5✔
26
""" The version of the module """
27

28
__revision__ = "$LastChangedRevision$"
5✔
29
""" The revision number of the module """
30

31
__date__ = "$LastChangedDate$"
5✔
32
""" The last change date of the module """
33

34
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
5✔
35
""" The copyright for the module """
36

37
__license__ = "Apache License, Version 2.0"
5✔
38
""" The license for the module """
39

40
import appier
5✔
41

42
class SocketController(appier.Controller):
5✔
43

44
    @appier.private
5✔
45
    @appier.route("/sockets", "GET")
5✔
46
    def list(self):
2✔
47
        app_id = self.session.get("app_id", None)
×
48
        state = self.state.get_state(app_id = app_id)
×
49

50
        sockets = []
×
51

52
        for socket_id, channel in state.socket_channels.iteritems():
×
53
            socket = dict(socket_id = socket_id, channel = channel)
×
54
            sockets.append(socket)
×
55

56
        return dict(
×
57
            sockets = sockets
58
        )
59

60
    @appier.private
5✔
61
    @appier.route("/sockets/<socket_id>", "POST")
5✔
62
    def show(self, socket_id):
2✔
63
        app_id = self.session.get("app_id", None)
×
64
        state = self.state.get_state(app_id = app_id)
×
65
        channels = state.socket_channels.get(socket_id, [])
×
66

67
        return dict(
×
68
            channels = channels
69
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc