当前位置: 首页>>代码示例>>Python>>正文


Python SocketIO.debug方法代码示例

本文整理汇总了Python中flask_socketio.SocketIO.debug方法的典型用法代码示例。如果您正苦于以下问题:Python SocketIO.debug方法的具体用法?Python SocketIO.debug怎么用?Python SocketIO.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_socketio.SocketIO的用法示例。


在下文中一共展示了SocketIO.debug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: receiving_sensor_update

# 需要导入模块: from flask_socketio import SocketIO [as 别名]
# 或者: from flask_socketio.SocketIO import debug [as 别名]
def receiving_sensor_update(json):
	print('sensor says: ' + str(json))


# this will come from client
@socketio.on('atime')
def atime(message):
	print('sensor says: ' + str(message))
	emit('atime', message, broadcast=True)

# this will come from client
@socketio.on('JSON')
def JSON(json):
	print('sensor says: ' + str(json))
	emit('JSON', json, broadcast=True)


if __name__ == '__main__':
	socketio.debug = False
	socketio.run(app, host='0.0.0.0', port=1234)










开发者ID:itsjesseyo,项目名称:water_sensor,代码行数:22,代码来源:app.py

示例2: emit

# 需要导入模块: from flask_socketio import SocketIO [as 别名]
# 或者: from flask_socketio.SocketIO import debug [as 别名]
    emit("character_sheet_sync", character_sheet)


# this will come from client
@socketio.on("status_update_request")
def status_update_request(json):
    status_json = {"id": character_sheet["id"], "status": character_sheet["status"]}
    emit("status_sync", status_json)


# this will come from client
@socketio.on("sync_section_by_key")
def sync_section_by_key(json):
    if "section_key" in json:
        # if they sent data, save it to server
        if "data" in json:
            # save data to server
            pass
            # always respond with data fragment
        json = {
            "id": character_sheet["id"],
            "section_key": json["section_key"],
            "data": character_sheet[json["section_key"]],
        }
        emit("sync_section_by_key", json)


if __name__ == "__main__":
    socketio.debug = True
    socketio.run(app)
开发者ID:kingian,项目名称:osric_sandbox,代码行数:32,代码来源:app.py


注:本文中的flask_socketio.SocketIO.debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。