mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-30 01:02:18 +02:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
39abd7cdea | ||
|
f988413a74 | ||
|
73b236b249 | ||
|
636a11daa3 | ||
|
0f147ef180 | ||
|
3cd0328c2a | ||
|
f5aa57452f | ||
|
7e89b8a685 |
76
.github/workflows/bob.yml
vendored
Normal file
76
.github/workflows/bob.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
name: Build with bob
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request_target:
|
||||
schedule:
|
||||
# nightly at 05:00 on the 1st and 15th
|
||||
- cron: 0 5 1,15 * *
|
||||
|
||||
env:
|
||||
VERSION_FILENAME: 'info.json'
|
||||
BUILD_SERVER: 'https://build.defold.com'
|
||||
|
||||
jobs:
|
||||
build_with_bob:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [armv7-android, x86_64-linux, x86_64-win32, x86-win32, js-web]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: Build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '11.0.2'
|
||||
|
||||
- name: Get Defold version
|
||||
run: |
|
||||
TMPVAR=`curl -s http://d.defold.com/stable/${{env.VERSION_FILENAME}} | jq -r '.sha1'`
|
||||
echo "DEFOLD_VERSION=${TMPVAR}" >> $GITHUB_ENV
|
||||
echo "Found version ${TMPVAR}"
|
||||
|
||||
- name: Download bob.jar
|
||||
run: |
|
||||
wget -q http://d.defold.com/archive/stable/${{env.DEFOLD_VERSION}}/bob/bob.jar
|
||||
java -jar bob.jar --version
|
||||
|
||||
- name: Resolve libraries
|
||||
run: java -jar bob.jar resolve --email a@b.com --auth 123456
|
||||
- name: Build
|
||||
run: java -jar bob.jar --platform=${{ matrix.platform }} build --archive --build-server=${{env.BUILD_SERVER}}
|
||||
- name: Bundle
|
||||
run: java -jar bob.jar --platform=${{ matrix.platform }} bundle
|
||||
|
||||
# macOS is not technically needed for building, but we want to test bundling as well, since we're also testing the manifest merging
|
||||
build_with_bob_macos:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [armv7-darwin, x86_64-darwin]
|
||||
runs-on: macOS-latest
|
||||
|
||||
name: Build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '11.0.2'
|
||||
|
||||
- name: Get Defold version
|
||||
run: |
|
||||
TMPVAR=`curl -s http://d.defold.com/stable/${{env.VERSION_FILENAME}} | jq -r '.sha1'`
|
||||
echo "DEFOLD_VERSION=${TMPVAR}" >> $GITHUB_ENV
|
||||
echo "Found version ${TMPVAR}"
|
||||
|
||||
- name: Download bob.jar
|
||||
run: |
|
||||
wget -q http://d.defold.com/archive/stable/${{env.DEFOLD_VERSION}}/bob/bob.jar
|
||||
java -jar bob.jar --version
|
||||
|
||||
- name: Resolve libraries
|
||||
run: java -jar bob.jar resolve --email a@b.com --auth 123456
|
||||
- name: Build
|
||||
run: java -jar bob.jar --platform=${{ matrix.platform }} build --archive --build-server=${{env.BUILD_SERVER}}
|
||||
- name: Bundle
|
||||
run: java -jar bob.jar --platform=${{ matrix.platform }} bundle
|
5
.github/workflows/trigger-site-rebuild.yml
vendored
5
.github/workflows/trigger-site-rebuild.yml
vendored
@@ -1,6 +1,9 @@
|
||||
name: Trigger site rebuild
|
||||
|
||||
on: [push]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
site-rebuild:
|
||||
|
@@ -1,5 +1,9 @@
|
||||
|
||||
|
||||
# Defold websocket extension
|
||||
|
||||
[](https://github.com/defold/extension-websocket/actions)
|
||||
|
||||
## Installation
|
||||
To use this library in your Defold project, add the following URL to your `game.project` dependencies:
|
||||
|
||||
|
@@ -73,7 +73,7 @@ local function websocket_callback(self, conn, data)
|
||||
update_gui(self)
|
||||
log("Connected: " .. tostring(conn))
|
||||
elseif data.event == websocket.EVENT_ERROR then
|
||||
log("Error: '" .. data.error .. "'")
|
||||
log("Error: '" .. tostring(data.error) .. "'")
|
||||
elseif data.event == websocket.EVENT_MESSAGE then
|
||||
log("Receiving: '" .. tostring(data.message) .. "'")
|
||||
end
|
||||
|
@@ -195,7 +195,6 @@ static WebsocketConnection* CreateConnection(const char* url)
|
||||
conn->m_SSLSocket = 0;
|
||||
conn->m_Status = RESULT_OK;
|
||||
conn->m_HasHandshakeData = 0;
|
||||
conn->m_WasConnected = 0;
|
||||
|
||||
#if defined(HAVE_WSLAY)
|
||||
conn->m_Ctx = 0;
|
||||
@@ -509,6 +508,12 @@ static dmExtension::Result AppFinalize(dmExtension::AppParams* params)
|
||||
|
||||
static dmExtension::Result Finalize(dmExtension::Params* params)
|
||||
{
|
||||
while (!g_Websocket.m_Connections.Empty())
|
||||
{
|
||||
WebsocketConnection* conn = g_Websocket.m_Connections.Back();
|
||||
g_Websocket.m_Connections.Pop();
|
||||
DestroyConnection(conn);
|
||||
}
|
||||
return dmExtension::RESULT_OK;
|
||||
}
|
||||
|
||||
@@ -566,10 +571,7 @@ static dmExtension::Result OnUpdate(dmExtension::Params* params)
|
||||
conn->m_BufferSize = 0;
|
||||
}
|
||||
|
||||
if (conn->m_WasConnected)
|
||||
{
|
||||
HandleCallback(conn, EVENT_DISCONNECTED, 0, conn->m_BufferSize);
|
||||
}
|
||||
|
||||
g_Websocket.m_Connections.EraseSwap(i);
|
||||
--i;
|
||||
@@ -676,7 +678,6 @@ static dmExtension::Result OnUpdate(dmExtension::Params* params)
|
||||
#endif
|
||||
dmSocket::SetBlocking(conn->m_Socket, false);
|
||||
|
||||
conn->m_WasConnected = 1;
|
||||
SetState(conn, STATE_CONNECTED);
|
||||
HandleCallback(conn, EVENT_CONNECTED, 0, 0);
|
||||
}
|
||||
|
@@ -100,8 +100,7 @@ namespace dmWebsocket
|
||||
Result m_Status;
|
||||
uint8_t m_SSL:1;
|
||||
uint8_t m_HasHandshakeData:1;
|
||||
uint8_t m_WasConnected:1;
|
||||
uint8_t :6;
|
||||
uint8_t :7;
|
||||
};
|
||||
|
||||
// Set error message
|
||||
|
Reference in New Issue
Block a user