mosquitto not authorised

Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.
The MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.
The Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.

最近需要用mqtt来实现消息处理,在windows上安装Mosquitto之后,不使用用户名密码提示connection refused: not authorised。结果添加用户名密码之后还是提示同样的错误。

Continue Reading

Django 代码保护

常用的代码保护不外乎下面几种方法:

发行 .pyc 文件
代码混淆
使用 py2exe
使用 Cython

django发布的需要以服务运行,通过其他的几种方法来实现保护,都不太现实。所以发布可以通过cython的方式实现。

1. 安装cython

pip3 install cython

2.在项目目录创建setup.py 编辑内容如下,其中“app/file1.py”是你所要打包的py文件名,这儿需要把app下所有的py文件都添加进来(当然也可以添加部分)

from distutils.core import setup

from Cython.Build import cythonize

fileSet = set()

fileSet.add("UserBase/models.py")
fileSet.add("UserBase/views.py")

setup(

    ext_modules=cythonize(fileSet)

)

Continue Reading

Freeswitch sip Push notifications

不管是安卓还是ios现在多数的app都无法长时间在后台运行(特殊权限以及应用除外),如果要想在app没有激活或者被冻结的情况下接收到来电,那么就需要先推送一条通知。

搜了一下有这么个插件:https://github.com/sem32/freeswitch-PushNotificator 尝试了一下发现编译起来比较麻烦,后来发现了这篇文章:https://www.zoiper.com/en/tutorials/push-notifications参考里面的关键代码,包含一个push.sh,代码如下:

Continue Reading

基于Freeswitch的语音视频通话

之前写过一篇《阿里云 opensips nat内网穿透》,当时是为了解决对讲机视频对讲的问题。但是之前的方案存在一个问题,那就是虽然服务器能够正常提供服务。但是在接通之后如果设备不在同一个局域网内就会导致有音频但是没有视频信息。这个问题困扰了很久,直到现在算是能够解决这个问题。出现上面这个问题的根本原因在于设备的网络层次关系太过复杂,视频信息没有办法透传。我不是语音视频方面的专家,集中nat结构我也不在叙述了,感兴趣的访问这个链接:https://www.cnblogs.com/zhumengke/articles/11204924.html

如果要在阿里云的服务器上,还需要升级绑定弹性网卡的相关内容,具体参考这里:https://developer.aliyun.com/article/228753?spm=a2c6h.13813017.content3.1.5cbc6532wDqNf4

Continue Reading