zoukankan      html  css  js  c++  java
  • uWebSockets的使用

    最近要使用WebSockets做实时推送,然后看到网上一篇文章

    https://www.jianshu.com/p/64e36cd3ed1a

    说uWebSockets如何如何好,就试一把

    项目主页 https://github.com/uNetworking/uWebSockets

    打开里面的vs项目文件,编译发现缺少uv.h

    项目里面也没有说要依赖某个库,一查这个库可是鼎鼎大名的libuv

    https://github.com/libuv/libuv

    关于libuv的一些介绍https://blog.csdn.net/linuxandroidwince/article/details/72297630

    决定自己编译一个库出来,libuv官方的文档说在win下编译,需要配置如下

    ### Windows
    
    Prerequisites:
    
    * [Python 2.6 or 2.7][] as it is required
      by [GYP][].
      If python is not in your path, set the environment variable `PYTHON` to its
      location. For example: `set PYTHON=C:Python27python.exe`
    * One of:
      * [Visual C++ Build Tools][]
      * [Visual Studio 2015 Update 3][], all editions
        including the Community edition (remember to select
        "Common Tools for Visual C++ 2015" feature during installation).
      * [Visual Studio 2017][], any edition (including the Build Tools SKU).
        **Required Components:** "MSbuild", "VC++ 2017 v141 toolset" and one of the
        Windows SDKs (10 or 8.1).
    * Basic Unix tools required for some tests,
      [Git for Windows][] includes Git Bash
      and tools which can be included in the global `PATH`.
    
    To build, launch a git shell (e.g. Cmd or PowerShell), run `vcbuild.bat`
    (to build with VS2017 you need to explicitly add a `vs2017` argument),
    which will checkout the GYP code into `build/gyp`, generate `uv.sln`
    as well as the necesery related project files, and start building.
    
    ```console
    > vcbuild
    ```
    
    Or:
    
    ```console
    > vcbuild vs2017
    ```
    
    To run the tests:
    
    ```console
    > vcbuild test
    ```
    
    To see all the options that could passed to `vcbuild`:
    
    ```console
    > vcbuild help
    vcbuild.bat [debug/release] [test/bench] [clean] [noprojgen] [nobuild] [vs2017] [x86/x64] [static/shared]
    Examples:
      vcbuild.bat              : builds debug build
      vcbuild.bat test         : builds debug build and runs tests
      vcbuild.bat release bench: builds release build and runs benchmarks

    1.配置python执行路径

    2.下载build/gyp 由于git clone https://chromium.googlesource.com/external/gyp build/gyp 这个地址墙了,所以替换为https://github.com/nodejs/node-gyp

    选取里面的node-gyp 的gyp目录拷贝到build/

    屏蔽这句

    echo git clone https://chromium.googlesource.com/external/gyp build/gyp
    @git clone https://chromium.googlesource.com/external/gyp build/gyp
    if errorlevel 1 goto gyp_install_failed
    goto have_gyp

     运行 vcbuild.bat

    生成libuv.lib
    uWebSockets项目中添加D:opensourcelibuv-v1.23.2libuv-v1.23.2include

    编译报错

    无法打开包括文件: “openssl/opensslv.h”: No such file or directory

    下载 https://github.com/openssl/openssl

    也可以直接 直接下载安装文件,里面所有的头文件,库都有,一定要选全版本,不能选择轻版本 https://slproweb.com/products/Win32OpenSSL.html  

  • 相关阅读:
    matlab curve fitting tool
    simulink model configuration parameter
    MATLAB小知识
    电源噪声与纹波
    各种“地”—— 各种“GND”
    一个不错的充电方案论坛:
    pre -regulator 前端稳压器
    LT4020替代方案
    power delivery功率输出
    LTC4020锂电池充电模块开发记录
  • 原文地址:https://www.cnblogs.com/baldermurphy/p/9759660.html
Copyright © 2011-2022 走看看