Coder Social home page Coder Social logo

devicehive-.net's Introduction

DeviceHive .NET framework

DeviceHive turns any connected device into the part of Internet of Things. It provides the communication layer, control software and multi-platform libraries to bootstrap development of smart energy, home automation, remote sensing, telemetry, remote control and monitoring software and much more.

Connect embedded Linux using Python or C++ libraries and JSON protocol or connect AVR, Microchip devices using lightweight C libraries and BINARY protocol. Develop client applications using HTML5/JavaScript, iOS and Android libraries. For solutions involving gateways, there is also gateway middleware that allows to interface with devices connected to it. Leave communications to DeviceHive and focus on actual product and innovation.

Please refer to the DeviceHive website for more information.

Project overview

This project includes .NET implementation of the following DeviceHive componenets:

Server application

The Server is a web application which implements DeviceHive RESTful API. It could be installed on a dedicated server in order to build a private or public DeviceHive network.

The server application provides core features of DeviceHive such as:

  • Support of user accounts, access keys, authentication and access control
  • Access to information about networks and devices
  • Routing of messages between clients and devices
  • Various business-oriented tasks (e.g. device status control, device equipment state tracking, etc.)

The .NET server supports Cross-Origin Resource Sharing (CORS) standard, so the corresponding DeviceHive resources could be accessed from websites hosted on different domains using AJAX requests.

Installation

The following OS and applications are required for the DeviceHive .NET server to operate:

  1. Windows Server 2008 (or higher) or Windows 7
  2. Microsoft IIS 7 (or higher)
  3. Microsoft .NET Framework 4.5.2 (or higher)
  4. MongoDB 2.6 (or higher) or Microsoft SQL Server 2008 (or higher)

The setup package could be built from the sources or downloaded from the DeviceHive downloads page.

Client library

.NET client library is a wrapper around DeviceHive RESTful API which includes set of methods to access corresponding DeviceHive resources. This library could be used in .NET applications to enable their interaction with the DeviceHive service to monitor and control all registered devices.

The library supports the following actions:

  • Get information about DeviceHive networks, devices and device classes
  • Get current state of equipment that devices have onboard
  • Get real-time notifications from devices about various events
  • Send a command to a particular device

Client library is available in two options: .NET Framework 4.5 library and .NET Portable Library which targets the following frameworks: .NET for Windows Store Apps (Windows 8.1+) and Windows Phone 8.1+.

Installation and Usage

The library is available via NuGet: http://www.nuget.org/packages/DeviceHive.Client/

Please refer to the VirtualLed Client Tutorial to see step-by-step instructions on how to configure and launch sample VirtualLed client based on the .NET DeviceHive client libraries.

Client Portable Library usage in Windows 8.1 is described in the DeviceHive Manager Windows 8 Application Tutorial.

See Library Reference for more detailed information on library classes and methods.

Device and Gateway libraries

These libraries were created in order to support device prototyping and development on the .NET platform. Despite the fact that .NET framework has limited usage on embedded devices, it still may be appropriate to run devices using it in some cases. For example, equipment may be connected directly to a computer’s IO ports, or a Windows PC may act as a proxy/gateway between DeviceHive and actual low-level devices utilizing a different protocol.

Another reason to use .NET framework as platform for devices is to quickly prototype a device simulator on a high-level language. This will allow developers to create and debug other components in the system without involving actual hardware.

The library consists of two primary parts:

  1. DeviceHive domain objects and a wrapper around DeviceHive RESTful API. The library implements all necessary API methods to support the following actions:
  • Register new or existing device in the DeviceHive
  • Send notifications about various events to clients
  • Get real-time commands from clients
  • Update clients about command execution result
  1. Bases classes for devices and device hosting support.

Devices can be implements as simply as deriving from the DeviceBase class, overriding the Main function and declaring action methods to handle commands from clients. The library also provides DeviceHost class that connects device implementations with DeviceHive API interfaces to route all incoming and outgoing messages.

Please refer to the VirtualLed Device Tutorial to see step-by-step instructions on how to configure and launch sample VirtualLed device based on the .NET DeviceHive device library.

See Library Reference for more detailed information on library classes and methods.

Build instructions

In order to build all components, run the /src/build.cmd script. The build output will be placed into the /bin folder. The following tools are required for making the build:

  1. Microsoft Visual Studio 2013 Update 2 or later
  2. Microsoft .NET Framework 4.5.2 Developer Pack
  3. WiX Toolset
  4. MSBuild Community Tasks

Alternatively, individual components can be built using the build.cmd scripts in the corresponding component folders.

Change history

2.0.0

  • API: Added ability for users to block devices (device.isBlocked field)
  • API: The user entity now includes 'data' field for storing arbitrary data
  • Server: Added server installer project
  • Server: Do not return HTTP 400 in pollMany calls if specified deviceGuid is invalid
  • Server: Performance optimizations for MongoDB database
  • Server: Performance optimizations for inter-server communications in cluster environment
  • Server: Support for reading client IP address from a HTTP header (for proxy server scenarios)
  • Client: Added support for Reconnecting state
  • Client: Added DeviceHiveClient.WaitCommandResultAsync method to get awaitable task for command result
  • Client: Allow to set custom HttpMessageHandler in the RestClient contructor
  • Client: Extracted IRestClient interface from the RestClient class for better portability
  • Client: Added OldPassword field to the User entity for password changing functionality
  • Client: Portable library now targets Windows 8.1 and Windows Phone 8.1 platforms

1.3.1

  • API: New access key permission actions to cover administrative API methods
  • API: New authentication API for creating session access keys, it also supports user authentication via OAuth
  • API: Added social provider details to the User resource; password is now optional
  • API: Device.Key field is now optional
  • API: Device deletion is now allowed to devices
  • Client: Introduced IDeviceHiveClient interface to simplify unit testing
  • Client: Get rid of Microsoft.AspNet.WebApi.Client dependency

1.3.0

  • API: Added support for access key authentication in REST and WebSocket APIs
  • API: Added API resources for managing user API keys and their permissions
  • API: WebSocket client API has been extended to support device actions
  • API: Client credentials (or API keys) can now be used to perform device-specific actions
  • API: Added ability to subscribe to notification or commands with specific name
  • API: Added API methods to retrieve grouped historical notifications
  • API: Added support for OAuth 2.0 protocol for access key retrieval (DeviceHive appears as authorization and resource server)
  • API: Added API resources for managing OAuth clients and grants to support OAuth 2.0 key exchange
  • API: Equipment object is now always returned as part of the DeviceClass object
  • API: Device GUID may now be an arbitrary string
  • Server: The server has been migrated to .NET 4.5 and Entity Framework 6.1
  • Server: Added support for handling WebSocket ping/pong frames
  • Server: The device is now kept online if it's polling for commands or sending WebSocket ping frames
  • Server: Introduced mechanism for attaching custom plug-ins which can inspect all transmitted notifications and commands
  • Server: Introduced configurable user password policy
  • Client: The library has been migrated to .NET 4.5 with support for async methods
  • Client: Internal implementation now relies on "channel" abstractions to support REST and WebSocket protocols

DeviceHive license

DeviceHive is developed by DataArt Apps and distributed under Open Source MIT license. This basically means you can do whatever you want with the software as long as the copyright notice is included. This also means you don't have to contribute the end product or modified sources back to Open Source, but if you feel like sharing, you are highly encouraged to do so!

© Copyright 2015 DataArt Apps · All Rights Reserved

devicehive-.net's People

Contributors

alexey79 avatar deus42 avatar toxsedyshev avatar vyrostkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devicehive-.net's Issues

Offline timeout doesn't work

I have register device with the following parameters:

{"deviceClass":"id":32,"name":"TestDevice","version":"0.1","isPermanent":false,"offlineTimeout":15,"data":null}}

Then I shut-down the device and status of device is never changed to 'offline'.

Anyone know this error for testing samples of virtualled.

in device sample on local area.
devicehive server is windows 2012 std x64. and websocket is disabled.

Let me know why this error occured.

Error : The operation has timed out

2013-11-28 13:35:55,139 [9] INFO DeviceHive.Device.DeviceHost - Starting device host
2013-11-28 13:35:55,149 [9] INFO DeviceHive.Device.DeviceHost - Registering device e50d6085-2aba-48e9-b1c3-73c673e414be (Sample VirtualLed Device)
2013-11-28 13:35:55,155 [9] DEBUG DeviceHive.Device.RestfulDeviceService - Calling GET /info
2013-11-28 13:35:55,259 [9] DEBUG DeviceHive.Device.RestfulDeviceService - Calling PUT /device/e50d6085-2aba-48e9-b1c3-73c673e414be
2013-11-28 13:35:55,452 [9] INFO DeviceHive.Device.DeviceHost - Staring device e50d6085-2aba-48e9-b1c3-73c673e414be (Sample VirtualLed Device)
2013-11-28 13:35:55,458 [9] INFO DeviceHive.Device.DeviceHost - Subscribe to device e50d6085-2aba-48e9-b1c3-73c673e414be (Sample VirtualLed Device) commands
2013-11-28 13:35:55,459 [9] DEBUG DeviceHive.Device.RestfulDeviceService - Calling GET /info
2013-11-28 13:35:55,464 [9] INFO DeviceHive.Device.DeviceHost - Device host is now running
Device is now running, press any key to stop...
2013-11-28 13:35:55,467 [6] DEBUG DeviceHive.Device.RestfulDeviceService - Calling GET /device/e50d6085-2aba-48e9-b1c3-73c673e414be/command/poll?timestamp=2013-
11-28T04:35:55.019788
2013-11-28 13:35:55,475 [11] INFO DeviceHive.Device.DeviceHost - Sending notification 'equipment' from device e50d6085-2aba-48e9-b1c3-73c673e414be (Sample Virt
ualLed Device)
2013-11-28 13:35:55,478 [11] DEBUG DeviceHive.Device.RestfulDeviceService - Calling POST /device/e50d6085-2aba-48e9-b1c3-73c673e414be/notification
2013-11-28 13:36:25,488 [6] DEBUG DeviceHive.Device.RestfulDeviceService - Calling GET /device/e50d6085-2aba-48e9-b1c3-73c673e414be/command/poll?timestamp=2013-
11-28T04:35:55.019788
2013-11-28 13:36:55,497 [6] DEBUG DeviceHive.Device.RestfulDeviceService - Calling GET /device/e50d6085-2aba-48e9-b1c3-73c673e414be/command/poll?timestamp=2013-
11-28T04:35:55.019788
2013-11-28 13:37:25,511 [6] DEBUG DeviceHive.Device.RestfulDeviceService - Calling GET /device/e50d6085-2aba-48e9-b1c3-73c673e414be/command/poll?timestamp=2013-
11-28T04:35:55.019788
2013-11-28 13:37:35,544 [11] ERROR DeviceHive.Device.DeviceHost - Exception while sending notification 'equipment' from device e50d6085-2aba-48e9-b1c3-73c673e41
4be (Sample VirtualLed Device)
System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at DeviceHive.Device.RestfulDeviceService.Post[T](String url, Guid deviceId, String deviceKey, T obj) in s:\Open Source Projects\devicehive.com\Stable\1.2.0
.net\src\Device\DeviceHive.Device\Service\RestfulDeviceService.cs:line 462
at DeviceHive.Device.RestfulDeviceService.SendNotification(Guid deviceId, String deviceKey, Notification notification) in s:\Open Source Projects\devicehive.
com\Stable\1.2.0.net\src\Device\DeviceHive.Device\Service\RestfulDeviceService.cs:line 176
at DeviceHive.Device.DeviceHost.SendNotification(DeviceBase sender, DeviceNotification notification) in s:\Open Source Projects\devicehive.com\Stable\1.2.0.
net\src\Device\DeviceHive.Device\Device\DeviceHost.cs:line 213
2013-11-28 13:37:35,559 [11] ERROR DeviceHive.Device.DeviceHost - Exception in main thread of device e50d6085-2aba-48e9-b1c3-73c673e414be (Sample VirtualLed Dev
ice)
System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at DeviceHive.Device.RestfulDeviceService.Post[T](String url, Guid deviceId, String deviceKey, T obj) in s:\Open Source Projects\devicehive.com\Stable\1.2.0
.net\src\Device\DeviceHive.Device\Service\RestfulDeviceService.cs:line 462
at DeviceHive.Device.RestfulDeviceService.SendNotification(Guid deviceId, String deviceKey, Notification notification) in s:\Open Source Projects\devicehive.
com\Stable\1.2.0.net\src\Device\DeviceHive.Device\Service\RestfulDeviceService.cs:line 176
at DeviceHive.Device.DeviceHost.SendNotification(DeviceBase sender, DeviceNotification notification) in s:\Open Source Projects\devicehive.com\Stable\1.2.0.
net\src\Device\DeviceHive.Device\Device\DeviceHost.cs:line 219
at DeviceHive.Device.DeviceHost.DeviceServiceChannel.SendNotification(DeviceNotification notification) in s:\Open Source Projects\devicehive.com\Stable\1.2.0
.net\src\Device\DeviceHive.Device\Device\DeviceHost.cs:line 376
at DeviceHive.Device.DeviceHost.DeviceServiceChannel.SendEquipmentNotification(String equipment, Object parameters) in s:\Open Source Projects\devicehive.com
\Stable\1.2.0.net\src\Device\DeviceHive.Device\Device\DeviceHost.cs:line 393
at VirtualLed.VirtualLedDevice.Main(CancellationToken token) in s:\Open Source Projects\devicehive.com\Stable\1.2.0.net\src\Device\Examples\VirtualLed\Devic
e\VirtualLedDevice.cs:line 28
at DeviceHive.Device.DeviceHost.MainDeviceTask(DeviceBase device) in s:\Open Source Projects\devicehive.com\Stable\1.2.0.net\src\Device\DeviceHive.Device\De
vice\DeviceHost.cs:line 283
2013-11-28 13:45:20,312 [6] DEBUG DeviceHive.Device.RestfulDeviceService - Calling GET /device/e50d6085-2aba-48e9-b1c3-73c673e414be/command/poll?timestamp=2013-
11-28T04:35:55.019788

Error object fields must not be capitalized

Wrong

If a server error occurs, returned JSON object contains capitalized fields. Here is the example:

{  
   "Message":"...",
   "ExceptionMessage":"..." 
}

Right

The object fields must not be capitilized to increase consistency through the whole RESTful API.

{  
   "message":"...",
   "exceptionMessage":"..." 
}

Internal server error on multiple device registration

When registering 2+ devices with the same deviceClass (but ids and keys are unique) with the minimum delay between each registration request an "Internal Server Error" with the status code 500 is thrown.

Request examples:

  • First Device

PUT http://localhost/api/device/first-test-device

{  
   "name":"Test Device With Sensors",
   "key":"key1",
   "network":{  
      "name":"Test Device Network"
   },
   "status":"Online",
   "deviceClass":{  
      "name":"Test Device",
      "version":"0.0.1",
      "equipment":[  
         {  
            "name":"Temperature Sensor",
            "type":"Sensor",
            "code":"70f31319a57e4eaa97bb6dcb89ccb2c5"
         },
         {  
            "name":"Accelerometer Sensor",
            "type":"Sensor",
            "code":"b27c94fed9e64f60aa893aa4e6458095"
         }
      ]
   }
}
  • Second Device

PUT http://localhost/api/device/second-test-device

{  
   "name":"Test Device With Sensors",
   "key":"key2",
   "network":{  
      "name":"Test Device Network"
   },
   "status":"Online",
   "deviceClass":{  
      "name":"Test Device",
      "version":"0.0.1",
      "equipment":[  
         {  
            "name":"Temperature Sensor",
            "type":"Sensor",
            "code":"70f31319a57e4eaa97bb6dcb89ccb2c5"
         },
         {  
            "name":"Accelerometer Sensor",
            "type":"Sensor",
            "code":"b27c94fed9e64f60aa893aa4e6458095"
         }
      ]
   }
}

Response returned from the server when registering second device:

{  
   "Message":"An error has occurred.",
   "ExceptionMessage":"Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.",
   "ExceptionType":"System.Data.Entity.Infrastructure.DbUpdateConcurrencyException",
   "StackTrace":"   at System.Data.Entity.Internal.InternalContext.SaveChanges()\r\n   at DeviceHive.Data.EF.DeviceClassRepository.Save(DeviceClass deviceClass)\r\n   at DeviceHive.Core.Services.DeviceService.ResolveDeviceClass(Device device)\r\n   at DeviceHive.Core.Services.DeviceService.SaveDevice(Device device, JObject deviceJson, Boolean verifyNetworkKey, Func`2 networkAccessCheck)\r\n   at DeviceHive.API.Controllers.DeviceController.Put(String id, JObject json) in c:\\Work\\DeviceHive\\Source\\devicehive-.net\\src\\Server\\DeviceHive.API\\Controllers\\DeviceController.cs:line 103\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClassc.<GetExecutor>b__6(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()",
   "InnerException":{  
      "Message":"An error has occurred.",
      "ExceptionMessage":"Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.",
      "ExceptionType":"System.Data.Entity.Core.OptimisticConcurrencyException",
      "StackTrace":"   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ValidateRowsAffected(Int64 rowsAffected, UpdateCommand source)\r\n   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()\r\n   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)\r\n   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)\r\n   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)\r\n   at System.Data.Entity.Internal.InternalContext.SaveChanges()"
   }
}

Cannot connect to DeviceHive Java 1.3 websocket endpoints

A 403 Unauthorized error is thrown when websocket is opened inside of the WebSocketChannel class (line 103).

This seems to be because a WebSocket4Net 0.10 version sends empty Origin header if the value is not provided. Also the glassfish server version for DeviceHive Java 1.3 does not support empty origin header.

The issue can be possibly fixed by updating the WebSocket4Net library to 0.11 version (the issue is fixed there), or by constructing and passing a valid originparameter to the WebSocket constructor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.