<commit_before>/*******************************************************************************
 * Copyright (c) 2015 SAP and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * SAP - initial API and implementation
 *******************************************************************************/

/* globals $ javax */
/* eslint-env node, dirigible */

exports.getSession = function() {
	return $.getExecutionContext().get("websocket-session");
};

exports.getSessions = function() {
	return $.getExecutionContext().get("websocket-sessions");
};<commit_msg>websocket enhanced<commit_after>/*******************************************************************************
 * Copyright (c) 2015 SAP and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * SAP - initial API and implementation
 *******************************************************************************/

/* globals $ javax */
/* eslint-env node, dirigible */

exports.getSession = function() {
	var internalSession = $.getExecutionContext().get("websocket-session");
	return new Session(internalSession);
};

exports.getOpenSessions = function() {
	return $.getExecutionContext().get("websocket-sessions");
};

/**
 * Session object
 */
function Session(internalSession) {
	this.internalSession = internalSession;
	this.getInternalObject = sessionGetInternalObject;
	this.sendText = sessionSendText;
	this.sendTextAsync = sessionSendTextAsync;
	this.getId = sessionGetId;
	this.close = sessionClose;
}

function sessionGetInternalObject() {
	return this.internalSession;
}

function sessionSendText(text) {
	this.internalSession.getBasicRemote().sendText(text);	
}

function sessionSendTextAsync(text) {
	this.internalSession.getAsyncRemote().sendText(text);	
}

function sessionGetId() {
	this.internalSession.getId();	
}

function sessionClose() {
	this.internalSession.close();	
}
{'fraction_non_alphanumeric': 0.23867595818815332, 'fraction_numerical': 0.006968641114982578, 'mean_word_length': 5.897897897897898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2639627', 'n_tokens_mistral': 597, 'n_tokens_neox': 567, 'n_words': 149}