
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
j-queue-sdk-web
Advanced tools
A TypeScript package to check WebSocket connection status and control web access with a popup
The J-Queue SDK Web is a JavaScript library for managing online queue systems in web applications. It provides a seamless integration with a WebSocket-based queue service, displaying a customizable popup UI to inform users about their queue status.
sessionStorage
for continuity.data-*
attributes on the script tag for easy setup.Install the SDK via npm:
npm install j-queue-sdk-web
Or include it directly in your HTML using a CDN (replace x.x.x
with the desired version):
<script src="https://unpkg.com/j-queue-sdk-web@<version>/dist/j-queue-sdk-web.js"></script>
Import and initialize the SDK in your JavaScript/TypeScript code:
import ConnectionJQueueSdkWeb from 'j-queue-sdk-web';
const config = {
wsUrl: 'https://api-extra-queue.pressai.kr',
apiUrl: 'https://api-extra-queue.pressai.kr',
socketConfig: {
query: { connect_key: 'your_connect_key' },
},
popupConfig: {
isShowLoadingOnConnect: true,
language: 'en',
textColor: '#276bff',
loaderGradientStart: '#276bff',
loaderGradientEnd: 'rgba(39,107,255,0.05)',
},
};
ConnectionJQueueSdkWeb.init(config)
.then(({ disconnect }) => {
console.log('J-Queue SDK initialized');
// Store disconnect function for later use
})
.catch((error) => {
console.error('Initialization failed:', error);
});
// Add a status listener
ConnectionJQueueSdkWeb.addStatusListener((status) => {
console.log('Queue status:', status);
});
Include the SDK script with data-*
attributes to auto-initialize:
<script
src="https://unpkg.com/j-queue-sdk-web@<version>/dist/j-queue-sdk-web.js"
data-ws-url="https://api-extra-queue.pressai.kr"
data-api-url="https://api-extra-queue.pressai.kr"
data-connect-key="your_connect_key"
data-show-loading="true"
data-language="ko"
data-mode="prod"
data-text-color="#276bff"
data-loader-gradient-start="#276bff"
data-loader-gradient-end="rgba(39,107,255,0.05)"
></script>
The SDK will automatically initialize using these attributes when the script loads.
The InitConfig
interface defines the configuration options:
wsUrl
: WebSocket URL (default: https://api-extra-queue.pressai.kr
for prod, https://dev-api-extra-queue.pressai.kr
for dev).apiUrl
: API URL for operations like leaving the queue.socketConfig
: Socket.IO configuration.
query
: Query parameters (e.g., { connect_key: 'your_key' }
).transports
: Transport methods (default: ['websocket']
).reconnectionAttempts
: Number of reconnection attempts (default: 3).reconnectionDelay
: Delay between reconnections (default: 1000ms).popupConfig
: Popup UI configuration.
content
: Custom HTML or a function returning HTML based on queue position.language
: 'en'
or 'ko'
(default: 'ko'
).textColor
: Text color for popup content.loaderGradientStart
: Starting color for loader gradient.loaderGradientEnd
: Ending color for loader gradient.style
: Custom CSS for the popup.isShowLoadingOnConnect
: Show loading popup during connection (default: false
).customEvents
: Handlers for custom WebSocket events.option
: Storage key settings.
storageTokenKey
: sessionStorage
key for queue token (default: 'queue_token'
).storageConnectKey
: sessionStorage
key for connect key (default: 'connect_key'
).init(config: InitConfig)
: Initializes the SDK. Returns a promise resolving to an object with a disconnect
method.addStatusListener(listener)
: Adds a callback to receive queue status updates.removeStatusListener(listener)
: Removes a status listener.getQueueStatus()
: Returns the current queue status ({ uuid, position, status }
or null
).initFromScriptAttributes()
: Initializes the SDK using script tag attributes (called automatically on load).Defined in the OnlineQueueStatus
enum:
WAITING
(1): User is waiting in the queue.ACTIVE
(2): User is active and can proceed.EMPTY
(3): Queue is empty or connect key is invalid.git clone <repository-url>
cd j-queue-sdk-web
npm install
The SDK includes unit tests using Jest. Run them with:
npm test
To build the SDK:
npm run build
Contributions are welcome! Please submit a pull request or open an issue to discuss changes.
MIT
FAQs
A TypeScript package to check WebSocket connection status and control web access with a popup
The npm package j-queue-sdk-web receives a total of 1,785 weekly downloads. As such, j-queue-sdk-web popularity was classified as popular.
We found that j-queue-sdk-web demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.