Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ CHINOOK_DATABASE_URL="sqlitecloud://user:password@xxx.sqlite.cloud:8860/chinook.
CHINOOK_API_KEY=xxxxxx

# sqlite cloud gateway for socket.io connections
GATEWAY_URL=ws://localhost:4000
GATEWAY_URL=ws://localhost:443
5 changes: 2 additions & 3 deletions examples/with-javascript-browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ <h1>SQLite Cloud Drivers</h1>
<div class="text-xs w-12">databaseUrl</div>
<input type="text" id="connectionStringInput"
placeholder="Example: sqlitecloud://admin:password@host.sqlite.cloud:8860/chinook.sqlite"
value="sqlitecloud://host.sqlite.cloud:8860?apikey=apikey"
class="border rounded w-full pl-2 pr-2 mb-2" />
value="sqlitecloud://host.sqlite.cloud:8860?apikey=apikey" class="border rounded w-full pl-2 pr-2 mb-2" />
<div class="text-sm w-12">sql:</div>
<input type="text" id="messageInput"
placeholder="Example: USE DATABASE chinook.sqlite; select * from customers limit 3"
Expand Down Expand Up @@ -51,7 +50,7 @@ <h2 class="pb-4">Results:</h2>
// connect via websocket to the gateway on the same server
const connectionConfig = {
gatewayUrl: `${window.location.protocol === 'https:' ? 'wss' : 'ws'
}://${window.location.hostname}:4000`,
}://${window.location.hostname}:443`,
connectionstring: connectionstring,
};
var database = new window.sqlitecloud.Database(
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sqlitecloud/drivers",
"version": "1.0.739",
"version": "1.0.779",
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -109,4 +109,4 @@
"browser": {
"tls": false
}
}
}
2 changes: 1 addition & 1 deletion src/drivers/connection-ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class SQLiteCloudWebsocketConnection extends SQLiteCloudConnection {
if (!this.socket) {
this.config = config
const connectionstring = this.config.connectionstring as string
const gatewayUrl = this.config?.gatewayurl || `${this.config.host === 'localhost' ? 'ws' : 'wss'}://${this.config.host as string}:4000`
const gatewayUrl = this.config?.gatewayurl || `${this.config.host === 'localhost' ? 'ws' : 'wss'}://${this.config.host as string}:443`
this.socket = io(gatewayUrl, { auth: { token: connectionstring } })

this.socket.on('connect', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export interface SQLiteCloudConfig {

/** True if we should force use of SQLite Cloud Gateway and websocket connections, default: true in browsers, false in node.js */
usewebsocket?: boolean
/** Url where we can connect to a SQLite Cloud Gateway that has a socket.io deamon waiting to connect, eg. wss://host:4000 */
/** Url where we can connect to a SQLite Cloud Gateway that has a socket.io deamon waiting to connect, eg. wss://host:443 */
gatewayurl?: string

/** Optional identifier used for verbose logging */
Expand Down
Loading