프로그래밍 193

flutter socket 연결후 데이타 계속 보내기 mymq 연결후 응답받음

. 서버 실행 [@localhost socket_server]# php server2_php.php SocketManager.dart import 'dart:io'; class SocketManager { late Socket _socket; bool _connected = false; static const String host = "220.72.212."; // php server static const int port = 25003; // static const String host = "13.125.57."; // mymq // static const int port = 9001; Future connectToSocket() async { try { _socket = await Socket.con..

flutter dart 에서 hexString 을 byte 로 변환 (소켓한번만연결)

목적 : flutter 에서 hexString 을 byte 로 변환하여 접속된 소켓으로 보내려고 한다. javascript 에서는 hexString 을 Uint8Array 로 변환한다. (arrayBuffer) # inutString 0000012931334331202020202020202020202020646f6d202020202057313931304130312020202020202020202020202020202020202020202020202020202020203030302e3030302e3030302e303030203030302e3030302e3030302e3030302030302d30302d30302d30302d30302d30302020205330313832383520202020202020202..

js 배열의 index 값을 객체의 키로 변경하는 방법 [] -> {}

아래와 같은 배열이 있습니다. 0: {id: 'prdctCd', value: 'USKRW'} 1: {id: 'realCode', value: 'USDKRW300'} length: 2 배열의 키가 0 , 1 숫자로 되어 있는것을 객체로 변경해야 할때가 있습니다. prdctCd: {id:'prdctCd', value:'USKRW'}, realCode: {id:'realCode', value:'USDKRW300'} 이렇게 변경하는 이유는 배열의 0 으로 접근하는 것보다는 키로 접근하는게 가독성이 좋습니다. 1차원 배열 변경 방법 const tmp = [ {id:'prdctCd', value:'USKRW'}, {id:'realCode', value:'USDKRW300'} ]; const object = tmp...

프로그래밍/Js 2023.06.20

vue3 composition api 에서 다른 컴포넌트 함수 호출

composition api 의 send.vue (자식 컴포넌트) 주의) defineExpose 없으면 작동하지 않습니다. 참고 : https://stackoverflow.com/questions/72223441/call-a-function-from-another-component-using-composition-api Call a function from another component using composition API Below is a code for a header and a body (different components). How do you call the continue function of the component 2 and pass a parameter when you are in..

프로그래밍/Js 2023.06.13

vue3 갑자기 Error: Cannot find module 'vue/compiler-sfc' 발생시

vue3 에서 어제까지 잘되던 부분이 오늘 갑자기 아래 오류를 발생한다. (macos) Error: Cannot find module 'vue/compiler-sfc' 해결방법 package.json 에 "@vue/compiler-sfc": "^3.2.13" { "name": "vue03", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "axios": "^0.27.2", "core-js": "^3.8.3", "iconv-lite": "^0.6.3",..

프로그래밍/Js 2023.05.19

intellij java11 + spring boot + 웹소켓 서버 (WebSocket Server) 구축

프로젝트 폴더(untitled1) 우측 마우스 클릭 Add Framework Supprot... 클릭 WebServices 체크 Apache Axis 변경 Spring MVC 체크 src/main/java 에서 패키지 생성 (kdh) .java Class 추가 ChatServer package kdh; import javax.websocket.*; import javax.websocket.server.ServerEndpoint; import java.io.IOException; import java.util.HashMap; import java.util.Map; @ServerEndpoint("/ws") public class ChatServer { private Map usernames = new Has..